Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

form validation and file uploading

9:13 pm on Apr 15, 2006 (gmt 0)

5+ Year Member

Hi, I have a form that has to upload a file, either pdf or cad, this isn't a problem. I can do this and I validate the file type, check its size and use is_uploaded_file().

The problem is that the rest of the form needs to be validated as well and there's alot of fields including emails and phone numbers. I was wondering if there's a way to validate the rest of the form input without uploading the file because the file could be quite large and it would suck to have to upload it twice if a phone number wasn't numeric.

I already use javascript to do client-side validation, but I think I need to use server side validation just in case as well. I was thinking of using opendir but wasn't sure if this would open the clients directory or a server directory and also if the input type wasn't file how would I include the browse button to open a window.

any answers welcome

9:23 pm on Apr 15, 2006 (gmt 0)

10+ Year Member

you could simply upload the file and re-direct the user to a new script/ page or the same page and have them only enter the fields again that where entered wrong ;)
9:54 pm on Apr 15, 2006 (gmt 0)

5+ Year Member

so if I redirect them to the same page to re-enter other fields it won't upload the file a second time. CHeers
10:01 pm on Apr 15, 2006 (gmt 0)

10+ Year Member

simple solution to a simple problem :)

sometimes you just need an outsiders view aight? :)


Featured Threads

Hot Threads This Week

Hot Threads This Month