snoodle Posted June 1, 2007 Share Posted June 1, 2007 I attempted to perform a file upload via Ajax and avoid the problems of a postback, but I finally got too tired and just went the normal form-postback route. The problem is, in my case, you are uploading photos which are to be linked (or inserted) to a selected row of a visual representation of an sql table. Of course, after the postback the selected table row (along with all other fields) are reset and I have no way of knowing which record to associate the uploaded file to. Help. This is my first posting on this site and I'm fairly new to this whole PHP, Javascript, AJAX stuff. Quote Link to comment https://forums.phpfreaks.com/topic/53884-file-uploadingpostback/ Share on other sites More sharing options...
snoodle Posted June 1, 2007 Author Share Posted June 1, 2007 Ok... I found one way to get around the problem. After hitting the browse button, but before hitting the Upload (submit) button, I am able to save the values I need in elements (hidden or not) that are contained in the form, then retrieve them later in the PHP code via $_POST['elem_name']. Is this the "normal" way to go about this when you are forced to do a submit/postback? Since I am doing a lot of ajax stuff (using xmlHttp) which seems to make things prettier for the user, and easier for the programmer. This file upload deal was the 1st time I was really forced to do the POST. Quote Link to comment https://forums.phpfreaks.com/topic/53884-file-uploadingpostback/#findComment-266467 Share on other sites More sharing options...
per1os Posted June 1, 2007 Share Posted June 1, 2007 http://bluga.net/projects/uploadProgressMeter/ Maybe that would help you out? Quote Link to comment https://forums.phpfreaks.com/topic/53884-file-uploadingpostback/#findComment-266473 Share on other sites More sharing options...
snoodle Posted June 2, 2007 Author Share Posted June 2, 2007 so now i am shoving values i need to save in hidden fields in the form to be submitted (the form that includes the file upload element). great. now, upon reload/postback, i cant fetch those values in PHP, but now I need to feed them back into the original HTML elements (via Javascript I would think). My head hurts. I'm really getting closer and closer to understanding this stuff and would prefer to not just patch in some mystery php/ajax upload code. any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/53884-file-uploadingpostback/#findComment-266615 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.