redbrad0 Posted March 14, 2009 Share Posted March 14, 2009 This isnt really a question on how to upload a image to the server but more how I can let the user select a file to upload and pass the location that the user wants to upload the image from to another page. This other page will allow them to fill out some additional information and then when they click submit, at that time it will upload the image to the server. I was thinking I might be able to pass the value thru a hidden input field, but I can't seem to get it to work. Is this even a possibility? Link to comment https://forums.phpfreaks.com/topic/149415-passing-upload-image-location-to-another-form-that-uploads/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 14, 2009 Share Posted March 14, 2009 The answer is NO. The type="file" input field can only be set by the browser's file selection dialog box, so there is no way that you can set the value="..." for it either in the html or using javascript. The file is also uploaded on the form submission where the type="file" has been selected and unless that form processing code does something with the temporary uploaded file, it is destroyed when the resources used on that page are released when the page ends execution. Link to comment https://forums.phpfreaks.com/topic/149415-passing-upload-image-location-to-another-form-that-uploads/#findComment-784763 Share on other sites More sharing options...
Ayon Posted March 14, 2009 Share Posted March 14, 2009 but isn't it possible to send the form with the file field to another page where the $_FILES array is stored in a session? then when submitting the form with the info etc the upload handler pulls out the info from the session? Link to comment https://forums.phpfreaks.com/topic/149415-passing-upload-image-location-to-another-form-that-uploads/#findComment-784778 Share on other sites More sharing options...
PFMaBiSmAd Posted March 14, 2009 Share Posted March 14, 2009 That is possible, but that is not the question that was asked. Link to comment https://forums.phpfreaks.com/topic/149415-passing-upload-image-location-to-another-form-that-uploads/#findComment-784792 Share on other sites More sharing options...
redbrad0 Posted March 14, 2009 Author Share Posted March 14, 2009 So if I store the _FILES into a array like suggested, then I can handle this? But doesn't that mean that the files will be uploaded to the server? I could just make the image upload the last part of the "wizard" but I would rather keep it where it is. So any suggestions on the way to handle this would be great. Link to comment https://forums.phpfreaks.com/topic/149415-passing-upload-image-location-to-another-form-that-uploads/#findComment-784795 Share on other sites More sharing options...
PFMaBiSmAd Posted March 14, 2009 Share Posted March 14, 2009 The form processing code where the uploaded file is submitted to would need to process the uploaded file - check for upload errors and if none, read the temporary uploaded file into a session variable and save the type and name information from the $_FILES array in other session variables. Link to comment https://forums.phpfreaks.com/topic/149415-passing-upload-image-location-to-another-form-that-uploads/#findComment-784805 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.