1internet Posted January 7, 2013 Share Posted January 7, 2013 So if you have a form, that also has an image upload facility, but on submit there are some errors so the form doesn't submit, but holds all the values that were there before submission - how can you hold the image value. i.e. do you have to always upload the image again? At least without the use of ajax. Quote Link to comment https://forums.phpfreaks.com/topic/272814-holding-an-image-value-for-upload/ Share on other sites More sharing options...
requinix Posted January 7, 2013 Share Posted January 7, 2013 You'd have to store the file somewhere temporarily and include something in the form which indicates to use that file (unless the user wants to upload a different file). Of course if the file itself causes an error then you wouldn't want to bother with this. Quote Link to comment https://forums.phpfreaks.com/topic/272814-holding-an-image-value-for-upload/#findComment-1404048 Share on other sites More sharing options...
haku Posted January 8, 2013 Share Posted January 8, 2013 Exactly. Your best bet is to save it to the temporary folder on your server, so it will be cleared out periodically. Then you will need to save the location of that file somewhere that the user cannot see (for security reasons), so a SESSION variable is probably best. Then you can reference this on the second (or third or whatever) submission attempt when there are no errors. Quote Link to comment https://forums.phpfreaks.com/topic/272814-holding-an-image-value-for-upload/#findComment-1404091 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.