Michdd Posted October 23, 2008 Share Posted October 23, 2008 Because the processing file and the file with the Form are in the same file, after a user uploads a file, if he refreshes it reuploads the file, how can I stop this without seperating the form file and the processing file? Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/ Share on other sites More sharing options...
hellonoko Posted October 23, 2008 Share Posted October 23, 2008 You could put in a line at the top that checks to see if the file exists on the server. Then if it does exist don't run the rest of the script. But that might prevent over writing of the file which you might not like. Also add in lines after the upload part of the script that clean out the variables holding the upload info. And then a check at the beginning perhaps. Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/#findComment-672394 Share on other sites More sharing options...
Michdd Posted October 23, 2008 Author Share Posted October 23, 2008 You could put in a line at the top that checks to see if the file exists on the server. Then if it does exist don't run the rest of the script. But that might prevent over writing of the file which you might not like. Also add in lines after the upload part of the script that clean out the variables holding the upload info. And then a check at the beginning perhaps. I already got the check, but how do I clear the variables? Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/#findComment-672410 Share on other sites More sharing options...
prexep Posted October 23, 2008 Share Posted October 23, 2008 unset($variable); Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/#findComment-672411 Share on other sites More sharing options...
samona Posted October 23, 2008 Share Posted October 23, 2008 What i do is I have a receipt page. You can create some kind of receipt page and have your script redirect to it once it is finished executing. Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/#findComment-672414 Share on other sites More sharing options...
Michdd Posted October 23, 2008 Author Share Posted October 23, 2008 What i do is I have a receipt page. You can create some kind of receipt page and have your script redirect to it once it is finished executing. If I redirect to the same page, the variables will be gone, right? Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/#findComment-672418 Share on other sites More sharing options...
prexep Posted October 23, 2008 Share Posted October 23, 2008 Yea, once you go to a new page or refresh the data is lost. It's like RAM once the computer is off all the data is gone. Once the page is gone (exit, refreshed, ect..) all the variables are gone. Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/#findComment-672426 Share on other sites More sharing options...
samona Posted October 23, 2008 Share Posted October 23, 2008 If you use sessions then the variables will still hold their values. Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/#findComment-672441 Share on other sites More sharing options...
prexep Posted October 23, 2008 Share Posted October 23, 2008 If you use sessions then the variables will still hold their values. Sessions will hold there value till the page is closed. But the variable will not hold its value. But a variable can be declared to hold the sessions value. So the variable isn't actually holding the data but the session itself. So the variable will be gone when gone to a different page but the session will still exist. Till browser is closed. Link to comment https://forums.phpfreaks.com/topic/129687-preventing-resubmission/#findComment-672443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.