Page 1 of 1

[solved] Upload validation design

Posted: Mon Sep 22, 2008 9:47 pm
by phpwalker
Hi all,

I'm doing an upload page, and I just want to allow a few types of file can be uploaded to the server. I store the file directly into database.

I've problems of validating the files being uploaded...

My flow is:
1)check if the submit button is set
2)check if it is allow file extension
3)check if the file size exceeds limit
4)check if the file size is equal to zero
5)if everything above is not true, proceed to storing the files..

However, there's problem when I do so. If the file is empty, it will return the message of "invalid file type" instead of "no file is uploaded".

So I've changed the flow a bit, check the file size is equal to zero first. When the file is too large, it will return message "no file is uploaded" instead of "file size exceeds limit"...
The same happens to a file which is disallow file type and is too large, it will also return message "no file is uploaded" instead of "invalid file type"...

Can anyone help me regarding the validation flow?

Thanks a lot...

Re: Upload validation design

Posted: Tue Sep 23, 2008 1:05 am
by phpwalker
Mod please help me to close this topic, i've solved it...

Thanks...