Search

Subscribe

Enter your email address to subscribe to this blog.

Recent Comments

Intro to Spring Security Core for Grails
Eric Pierce said: Thanks for these screencasts, Dan! You made it crazy simple to get up and running w/security core h... [More]

Removing duplicates from an array of objects
Arvind said: Great tip, can't thank you enough for this. [More]

Intro to Spring Security Core for Grails
Santosh said: Thanks much for putting up these screencasts. As the others here I'm a beginner and I've been having... [More]

Grails Spring Security Plugin - Logout postOnly setting
eriihine said: I still had some issues with this one. It seems that the href link is always generating a GET method... [More]

Intro to Spring Security Core for Grails
Dan Vega said: Just a heads up but I decided to write up a quick post on your question just in case it trips up any... [More]

CFMU Update: onCompleteAll

A couple people have asked about fixing up the events and with a prior release I was able to fix the on complete method. The on complete method will call a JavaScript method using the ExternalInterface library after each item in the list has been uploaded. Now that that works we needed a way to notify the client that all files were uploaded. After each file is successfully uploaded that file is removed from the files array. A quick check to see the length will let us know when we are done with all of the files

With that I decided to whip up a quick demo which is also in the download. This example will write each file name to the browser screen as its uploaded and then write out a message that all files are done.

If you want to downloaded the latest version along with all of the demos you can get it over at the CFMU Project Page on RIAForge

 
 

CFMU Bug Fix - Using External Interface

In my CFMU project I am using the ExternalInterface class. This class allows your application to communicate with the flash players container, in this case the ColdFusion template and JavaScript. I originally was giving users the ability to define a JS function that would be called when all of the files were uploaded. I had a couple people email telling me that it was just not working how it should be. When they were uploaded files the JavaScript method was being called right away while the file uploads were still in progress.

As soon as I heard this I realized what I had done. Let's take a look at the following code. When a user selects some files for upload and clicks on the upload button the following method is called. The variable _files is an array collection that holds a list of File references. The File Reference class has a method upload that is used to push the file to a remote server. You will also notice that I add some event listeners to each file. This lets us monitor the progress of the upload and is important for the feature we are working. The problem here is that I am calling the external interface method after each file is sent for upload. This does not mean that the file has actually been uploaded, just that Flash has done it's part. So what would happen is the list of files would immediately show up right after the user clicked upload and this is not what we want.

Continue Reading >>

 
 

CFMU 1.0 Released

I am happy to announce the release of my CFMU project as its finally hit version 1.0. I was able to fix a couple bugs so I figured no time like the present to get this out. I was able to fix one bug that was forwarded to me by a user. The user was having an issue with the max file size, basically it just was not working. The problem was with the flash vars being passed into the application. Its important to note that flash vars are case sensitive when your reading them in. If you have a second and you have not checked out the project yet, please do and let me know your thoughts.
 
 

Ask An Addict: CFMU upload and insert

I got this question from a user so I thought I would share it with everyone.

Anyway, I downloaded your CFMU tag and think it's amazing. I'd really like to be able to make use of it but would need to know the names of the files it uploads for storing in a database etc. I've been scratching my head over the OnComplete Advanced example you gave in the documentation but my JavaScript is useless and my ColdFusion knowledge just isn't good enough to work out a different way!

First off thanks for the kind words! Ok so the on complete method is really there to be used as a callback method. This will allow you to call a javascript method after the files have been uploaded. While I guess you could use this to make Ajax calls to your backend and write to a database I think there is a better way to go about this. If you download the latest zip I have added a new example.

Remember that all the uploader tag does is push the file to a specific URL. This is the example code from my the demo upload and insert. As you can see there is a URL attribute. This is the URL that gets called everytime we upload a file.

So we know its going to call a component name ImageHandler.cfc and a method named upload. Basically Flash passes the filename through a form variable to our remote method. The same way that we use the form.filename field to upload the file, we can use it to insert the name into a database. This example is very basic but as you can see we are uploading the image and adding it to our database. You could even take this a step further and wrap it in a transaction so that if either fail you can just rollback.

 
 

CFMU updated

I update my CFMU project to run on the latest Flex 4 framework which means you will need flash player 10 from now on. In the update I was able to fix a bug. If you are using the current project I suggest you update to the latest. If you had a list of files in the data grid and went to remove a file in the list it was removing the wrong one. Basically there was a problem with removing the wrong index. This was submitted to me by a user so thanks for the heads up!
 
 

More Entries