Gamerz Posted October 25, 2009 Share Posted October 25, 2009 Hey, I currently have a file uploader. I want to prevent a user from uploading the same files two times by making the page expire. My uploader is currently running on ONE script. The form and the processing page is all in one script. Not two, but one. And no, I don't want to use the location header redirection to prevent the user from uploading twice, because then, how is the user going to be able to know there file url? I just want the page to expire once the upload is completed. Quote Link to comment https://forums.phpfreaks.com/topic/178896-php-prevent-form-submit-twice/ Share on other sites More sharing options...
Gamerz Posted October 25, 2009 Author Share Posted October 25, 2009 hello? seriously, no one knows how? Quote Link to comment https://forums.phpfreaks.com/topic/178896-php-prevent-form-submit-twice/#findComment-943809 Share on other sites More sharing options...
Alex Posted October 25, 2009 Share Posted October 25, 2009 You could always use header('Location: '); and pass the url of their file in the query-string to get and display on a success page. eg. header('Location: success.php?file=' . $file_url); Then on success.php put something like: if(isset($_GET['file'])) { echo "Your file was successfully uploaded! URL: " . $_GET['file']; } Quote Link to comment https://forums.phpfreaks.com/topic/178896-php-prevent-form-submit-twice/#findComment-943842 Share on other sites More sharing options...
Gamerz Posted October 25, 2009 Author Share Posted October 25, 2009 Is there any other way except header location? I also have way more variables to pass on. The delete file, the file url, the e-mail, the password...it would be a really long url to pass on that much variables... Quote Link to comment https://forums.phpfreaks.com/topic/178896-php-prevent-form-submit-twice/#findComment-943862 Share on other sites More sharing options...
mikesta707 Posted October 25, 2009 Share Posted October 25, 2009 you could set a session or cookie after they upload, and every time a user tries to upload check if the session/cookie is set Quote Link to comment https://forums.phpfreaks.com/topic/178896-php-prevent-form-submit-twice/#findComment-943865 Share on other sites More sharing options...
dreamlove Posted October 25, 2009 Share Posted October 25, 2009 Use javascript to open a new window to show the FILE URL , then change top.location.href. Quote Link to comment https://forums.phpfreaks.com/topic/178896-php-prevent-form-submit-twice/#findComment-943867 Share on other sites More sharing options...
dreamlove Posted October 25, 2009 Share Posted October 25, 2009 you could set a session or cookie after they upload, and every time a user tries to upload check if the session/cookie is set If the user refresh the page, PHP script will not be executed until the file is uploaded. Quote Link to comment https://forums.phpfreaks.com/topic/178896-php-prevent-form-submit-twice/#findComment-943868 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.