tags:

views:

33

answers:

2

Hi ,

Is it possible once I have submitted a form to carry the uploaded file to the next page and place it back into a new form ?

A: 

If you are asking whether it is possible to display the contents of the uploaded file on a form that follows the upload, then yes.

If you are asking if it is possible to take the client side file path/name (the file input value) from the upload and place it in a form input that follows the upload, the not likely.

You won't get the full path to the original file from the upload, however you should get the original file name.

Jordan S. Jones
+1  A: 

No, an <input type="file"> control cannot be repopulated from an HTML page returned by a server-side script. If you are doing multi-part forms, you must either:

  1. store the file on the server side until the final part of the submission is complete (create an ID for the transaction when the first part of the submission comes in, save the file under that ID, put the ID in a hidden field and pick it up on the later submission; don't forget to clean up any files in the uploads directory from aborted partially-completed submissions); or

  2. do it as a single-page form submission, but use JavaScript to make it look as if it's a multi-page process by showing different parts of the form in order (and potentially XMLHttpRequest if you need trips back to the server to validate stuff halfway through). Ideally this should work as a single form without JavaScript too.

bobince
I like the javascript solution, if the form is not too complicated...
Nicky De Maeyer