Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- MAX_FILE_SIZE & error handling?
September 1, 2004, 5:05 pm
rate this thread
I'm working with file uploads and PHP. My upload form has a hidden input
with a MAX_FILE_SIZE name.
I'm curious how to error handle when this lmit is exceeded. What is the best
way to deal with such errors?
At the moment, the rest of my upload script runs which attempts to move the
uploaded file to a particular directory and to write the path into a MySQL
database. Of course the file is not actually uploaded so my script is
"spiining its wheels" so to speak.
Is there a best practice for dealing with errors generated by MAX_FILE_SIZE?
Re: MAX_FILE_SIZE & error handling?
I am working on the same idea. How to detect if the file size is greater
than the MAX_FILE_SIZE before trying to upload.
It looks like the file size is set to 0 if the max size is exceeded.
Can anyone confirm this?
If this is true, an IF (($file_size == 0) && (file_name !="")) could work.