Re[4]: [PHP] File Uploads!
| From: | Tom Rogers | Date: | Mon, 30 Jun 2003 02:46:23 +0000 |
| Subject: | Re[4]: [PHP] File Uploads! | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153358@lists.php.net to get a copy of this message | ||
Hi,
Monday, June 30, 2003, 4:14:02 AM, you wrote:
JW> On Sunday 29 June 2003 20:40, Tom Rogers wrote:
>> Maybe you have to wind up the post_max_size in php.ini and then control
>> with MAX_FILE_SIZE in the form for the error to show up in the $_FILES
>> array....
JW> "MAX_FILE_SIZE in the form" is client-side, for the benefit of the browser.
JW> *IF* the browser supports it then IT would stop the upload of files larger
JW> than MAX_FILE_SIZE.
JW> --
Jason Wong ->> Gremlins Associates -> www.gremlins.biz
JW> Open Source Software Systems Integrators
JW> * Web Design & Hosting * Internet & Intranet Applications Development *
JW> ------------------------------------------
JW> Search the list archives before you post
JW> http://marc.theaimsgroup.com/?l=php-general
JW> ------------------------------------------
JW> /*
JW> The early bird gets the coffee left over from the night before.
JW> */
php also checks for MAX_FILE_SIZE as you can see in rfc1867.c
while (!cancel_upload && (blen = multipart_buffer_read(mbuff, buff, sizeof(buff)
TSRMLS_CC)))
{
if (total_bytes > PG(upload_max_filesize)) {
sapi_module.sapi_error(E_WARNING, "upload_max_filesize of %ld bytes exceeded -
file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
cancel_upload = UPLOAD_ERROR_A;
} else if (max_file_size && (total_bytes > max_file_size)) {
sapi_module.sapi_error(E_WARNING, "MAX_FILE_SIZE of %ld bytes exceeded - file
[%s=%s] not saved", max_file_size, param, filename);
cancel_upload = UPLOAD_ERROR_B;
} else if (blen > 0) {
wlen = fwrite(buff, 1, blen, fp);
if (wlen < blen) {
sapi_module.sapi_error(E_WARNING, "Only %d bytes were written, expected
to write %ld", wlen, blen);
cancel_upload = UPLOAD_ERROR_C;
} else {
total_bytes += wlen;
}
}
}
So I set max post to something huge then control it on a form by form
basis,, which seems to work fine and fills in the error bit for me if
it is too big
--
regards,
Tom