Settings to Allow Precise File Upload Bytes

Dee Ayy <[email protected]>
Newsgroups gmane.comp.php.general,gmane.comp.php.database
Message-ID <CAFXM-axsg73VUQCL_XDPo3WAkBh0-pjfJXp+SgUY=1yrz6ZE3g@mail.gmail.com>
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
part).

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.


TIA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.