Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
March 19, 2005, 12:17 am
rate this thread
I need to read an uploaded file into chunks, so I can examine the acculative
size between chunks to
determine if a maximum size is being exceeded. I'm currently using the PHP
"move_uploaded_file()" to move it in one piece. But, I'm finding some clients
files are bigger than
I want to allow, and with that function I don't have an opportunity to determine
that until the
entire file has been uploaded.
Thanks for any help.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Re: How to read uploaded file in chunks using PHP?
No you don't. To limit the maximum size of an upload, you can simply
set proper values for upload_max_filesize and post_max_size
directives and check the value of $_FILES['form_field']['error'] after
the upload. If if is equal to UPLOAD_ERR_INI_SIZE constant (or,
numerically, 1), you can delete the file from the temporary directory
and tell the user to control his uploading appetites.
An alternative is to specify a MAX_FILE_SIZE field in the upload form
and compare the value of $_FILES['form_field']['error'] with
UPLOAD_ERR_FORM_SIZE (or 2).
For more information, see: