0

Hi All

I'm trying to build a page that has a captcha and allows for a file upload.

Currently when I select a file, fill in the captcha and hit submit the file is uploaded to the server in a temp directory before checking the captcha. I need the captcha checked first before the file is uploaded.

Is there a way to spoof the browse box so that I can get the path for the file and use it on a secondary page that automatically uploads the file if the captcha is entered correctly and then takes the user to a confirmation page?

Any help would be greatly appreciated. :)

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Venom Rush
0

This is one of those dilemmas you have to code around.

Files uploaded to the tmp directory are usually deleted at the end of script execution. If you are wanting to remember the uploaded file for the next page load (like to show an error message) you are going to have to move the file from the tmp directory and move it to your own tmp directory. Pretty much a custom directory that won't delete files. You will need to run some code to keep it clean though.

Then when they finally fill out the form correctly you move the uploaded file to its final directory and delete the file in the custom temp folder.

Honestly this wasn't easy to get working properly, its going to take some time.

There might be js solutions, but I like this method rather and relying on javascript.

Edited by somedude3488: n/a

0

This is one of those dilemmas you have to code around.

Files uploaded to the tmp directory are usually deleted at the end of script execution. If you are wanting to remember the uploaded file for the next page load (like to show an error message) you are going to have to move the file from the tmp directory and move it to your own tmp directory. Pretty much a custom directory that won't delete files. You will need to run some code to keep it clean though.

Then when they finally fill out the form correctly you move the uploaded file to its final directory and delete the file in the custom temp folder.

Honestly this wasn't easy to get working properly, its going to take some time.

There might be js solutions, but I like this method rather and relying on javascript.

So what you're saying is that the file will upload first (to a tmp directory) regardless of anything else? And I won't be able to validate a captcha before the file is uploaded? :(

0

Ok, thanks for the info ;) Guess I'm going to have to resort to a two stage process.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.