Please advise the proper settings (Apache/PHP/HTML/MySQL/Anything else
I missed) to allow a specific byte size upload and to deny 1 byte over
with error reporting in LAMP/AJAX.  I've heard of Flash and Gears
solutions, but these require additional installs for the user -- just
to know the file size before an upload.

The server is Apache 2.
PHP is 5.1.6
HTML has
<!DOCTYPE html>
<input type="hidden" name="MAX_FILE_SIZE" value="1030000" />
<input type="file" name="attachment" />

PHP ini :
file_uploads    On      On
upload_max_filesize     2M      2M
post_max_size   8M      8M

I believe MySQL max_allowed_packet 1,048,576 was affecting the MySQL
INSERT, so I changed MAX_FILE_SIZE to 1030000 above.

Now I am seeing cases where
if(isset($_FILES['attachment']) && $_FILES['attachment']['size'] > 0){
evaluates to FALSE

How can I know that a file upload was attempted yet failed or will fail?

My last test case had the web page still claiming it was busy, yet I
noticed that the above condition must have evaluated to FALSE, failing
silently due to missing error reporting on my part (or the system's

I am willing to make 2 requests:
1) just to find out if the attempted upload will fail and inform the user.
2) for the actual upload if it should succeed.


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to