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.
This entry was posted on July 8, 2009 at 11:12 PM and has received 2483 views. Comments 3 |
Print this entry.