snoodle
06-06-2007, 05:32 AM
I have read and tried so many different approaches to solving this problem but am still unable to get it working...
First let me describe the html page and what I'm trying to accomplish...
I have a table/list, populated by a database. Each record (row) has an associated picture that gets displayed when you click on a row in the list. That all works great (the picts are stored in a folder on the server and records in the db table are linked to the filenames). There are also a bunch of other controls on the page (sort by, filters, etc), so the rendering of the table is done the ajax way so all of the controls retain their values when the list is reset.
On this page you are also able to edit and add new records (also using ajax techniques) and that all works great.
The problem is the notorious File Upload gizmo. I would like to be able to select the desired entry in the list, hit the file upload button, and have their picture appear without the page being reset.
If I do it the "normal" way (form/submit) and keep the php code to upload the file on the same page, the page, of course, gets a postback and I have to deal with somehow resetting all the controls back to their origial values (ugly).
I did manage to do the upload via AJAX, but then had the problem of refreshing the screen with the new photo.
I know this topic has been beat to death (I've googled dozens of articles on the subject) but was wondering if anyone had any suggestions on how to approach the problem. There was one I found (Asynch image file upload without AJAX - http://www.air4web.com/files/upload/), but I (a) couldn't get the code to work, and (b) I believe you can see in their sample that the page is getting a postback and resetting controls.
Any help would be most appreciated. You guys have been great!
First let me describe the html page and what I'm trying to accomplish...
I have a table/list, populated by a database. Each record (row) has an associated picture that gets displayed when you click on a row in the list. That all works great (the picts are stored in a folder on the server and records in the db table are linked to the filenames). There are also a bunch of other controls on the page (sort by, filters, etc), so the rendering of the table is done the ajax way so all of the controls retain their values when the list is reset.
On this page you are also able to edit and add new records (also using ajax techniques) and that all works great.
The problem is the notorious File Upload gizmo. I would like to be able to select the desired entry in the list, hit the file upload button, and have their picture appear without the page being reset.
If I do it the "normal" way (form/submit) and keep the php code to upload the file on the same page, the page, of course, gets a postback and I have to deal with somehow resetting all the controls back to their origial values (ugly).
I did manage to do the upload via AJAX, but then had the problem of refreshing the screen with the new photo.
I know this topic has been beat to death (I've googled dozens of articles on the subject) but was wondering if anyone had any suggestions on how to approach the problem. There was one I found (Asynch image file upload without AJAX - http://www.air4web.com/files/upload/), but I (a) couldn't get the code to work, and (b) I believe you can see in their sample that the page is getting a postback and resetting controls.
Any help would be most appreciated. You guys have been great!