views:

260

answers:

2

Does anyone have a demo of using uploadify with additional fields and saving to database? The site's examples don't explain the process in depth and I am not familiar with jquery.

I don't know why but I can't get my head around how too integrate the two. I have the demo working and I have my app which uses traditional php/html forms working.

I need to conduct basic form collection with uploadify in the mix. Collect data and check data with feedback and then process into database and post back a confirmation.

  1. How do I feed information back to the uploadify form if there is a problem from the upload.php file?

  2. How do I access my data in the upload.php file?

  3. how do I redirect the upload page to a confirmation page after a succeeful upload?

A: 

When i used uploadify i would get it to store the uploaded file in a temporary directory and then upon submitting the form with the rest of the data i would move the file and rename it using mysql_insert_id(), dunno if that's any help!

To check for errors i would use jquery with a function(e) call back where uploadify echoes 'TRUE' or 'FALSE' depending on whether the upload worked - does this make sense?

Haroldo
Not really since i'm jquery challenged. I've always done my error checking server side since you can't depend on Javascript being enabled anyway. My main challege right now is not understanding how to update the user screen if he does not fill out a form correctly before uploading.
Curtis
then you want uploadify to be a callback on success of form validation..
Haroldo
well I'm just not fluent in jquery, uploadify was a bit puzzling t me with how to pass back information from the upload.php file. But I now have had more success with Fancy Upload . Perhaps I'll go back and take another look at uploadify. I was also stumped on how to handle the asynchronous aspect of the program . A traditional form is more straight forward in that regard.
Curtis
Hi curtis, if you're still struggling with this its worth looking at http://www.plupload.com/ which i now use instead of uploadify. It's still got a few too many features for my liking but it may be easier than uploadify... good luck
Haroldo
also, make sure, whenever you (or in this case uploadify on your behalf) is doing anything with ajax you have the console tab open in firebug
Haroldo
A: 

It looks like you want a classic form, but enhance the file upload using Uploadify.

If your reason for using Uploadify is the progress bar, take a look at my question Adding unobtrusive progress bar to old-school file uploads where I essentially asked for the same thing you want (but with a focus not on Uploadify but on the bar).

Pekka
Yeah basically, I already have a work flow in place and code that works a specific way. But now I think I like the queued upload features of uploadify.I just don't know jquery so thats a challenge. I don't have APC loaded on my server either.
Curtis
For instance, for what ever reason the uploadify file doesn't read a session variable. I know that doesn't make any sense but teh same code added to a blank file works. I think its all encapsulated in json/ajax/jquery code that I don't fully understand. Otherwise its pretty cool stuff.
Curtis
@Curtis you will need to transmit the session ID manually. The key is the `scriptData` setting (docs here: http://www.uploadify.com/documentation/) but I don't know Uploadify in detail so I can't tell you the exact way how to initialize it. Most likely, there is a `uploadify()` call somewhere in your script where you can add that variable, and put stuff in it.
Pekka
You suggestion of session ID manually is helpful - I will try that.
Curtis
Curtis
@Curtis that looks exactly right. I think the way you need to go for the rest of the form fields is populate the `scriptData` array with the form field values when submitting the form. It might be worth asking another question targeting exactly that.
Pekka