class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
I don't know the code of your form, but error 2 means: File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form)
Otherwise, try to raise your memory limit and file upload limit in php.iniReply
The code is below. I notice that the $_FILES['binFile'][size] always returns 0 on files larger than about 750 to 800 Kb. but it is correct on files smaller.
I notice that the $_FILES['binFile'][size] always returns 0 on files larger than about 750 to 800 Kb. but it is correct on files smaller.
That leads me to think that there is a problem with your setup of PHP. The class only reads what is in $_FILES. If the information is not correct, it will assume that the upload is not good. In fact, if the size value is 0, it means that the upload wasn't successful, for some reason.
Thank you for your help. It was occuring on three servers. It was NOT the fault of the class, it was a form problem. We had never had to upload such large files before, so our old class was fine until now.
We replaced it with this one... but the problem was that we were not specifying MAX_FILE_SIZE as hidden input in the upload form...
We added the following hidden input line to the form and eliminated the problems!
It seems like this is required whatever your php.ini says, otherwise the $_FILES array is empty for larger files that the default except for the file name.
It works fine with files under 1 Mb. What is file_src_error 2? If I resize the image to be less than 1 Mb raw file size, it works ok.
File upload error (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form)
Otherwise, try to raise your memory limit and file upload limit in php.ini
The code is below. I notice that the $_FILES['binFile'][size] always returns 0 on files larger than about 750 to 800 Kb. but it is correct on files smaller.
The php.ini settings are
My code:
Regards!
That leads me to think that there is a problem with your setup of PHP. The class only reads what is in $_FILES. If the information is not correct, it will assume that the upload is not good. In fact, if the size value is 0, it means that the upload wasn't successful, for some reason.
Does your code work on another server?
We replaced it with this one... but the problem was that we were not specifying MAX_FILE_SIZE as hidden input in the upload form...
We added the following hidden input line to the form and eliminated the problems!
It seems like this is required whatever your php.ini says, otherwise the $_FILES array is empty for larger files that the default except for the file name.
Great piece of work you have done here.
Regards!