Hi there

I'd just like to know if this is possible. I have a form with various fields that are filled out by a user along with a captcha and a file input. My problem is that when ever I execute the form the file is uploaded to the server before the captcha has been verified. So a user ends up waiting for the file to upload only to find out after his 10meg file has been uploaded that he entered the captcha code incorrectly (file stays in server temp folder if captcha is incorrect).

So what I want to do is have a form tag around my table with the fields and then have a form tag around the file input only and when the user hits submit it checks the captcha, then refers to the file and uploads it if the captcha is correct.

Recommended Answers

All 3 Replies

What you could do is modify the onsubmit property of the form to send an AJAX request to validate the CAPTCHA, if that validates then return true(submit the form), or return false(cancels the submit)

Hey Shawn

Thanks for the response. Looking at a security point of view would using ajax not be subject to being worked around to ignore the captcha check and simply upload a file?

I've been doing some googling and I've come across some solutions that use fsockopen. The problem is that in all these solutions the "coder" knows what the file is they'd like to upload.

Is there anyone here that's used fsockopen for uploading files that can help me?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.