|
Posted by Jefferis NoSpamme on 07/03/06 13:37
On 7/3/06 3:23 AM, in article VB3qg.13310$_u1.2178@reader1.news.jippii.net,
"Kimmo Laine" <spam@outolempi.net> wrote:
Thank you for the help Kimmo.
>
> Here's a magical line that tells user agent (browser) not to post files
> larger than 5000. In this case $_FILES['file']['error'] should contain the
> value of UPLOAD_ERR_FORM_SIZE .
>
I have read that the browser function on file size is not reliable and
works only on some browsers. I think I'm having a problem understanding how
the Max_File_Size value field is functioning and what it communicates to the
server. I looked up that reserved word on php and it isn't a php function,
but apparently is a server html function... Is the error value added by a
$var definition on the php page or is it fed to the php target by the Max
File form field???
Thanks
Jeff
>
> If you want to hard limit to 3 megs, you can just adjust this:
> <input type="hidden" name="MAX_FILE_SIZE" value="5000" border="0">
> to
> <input type="hidden" name="MAX_FILE_SIZE" value="3000" border="0">
>
>
> If you wanna do really good errormessages, try something similar to what I
> did with a file uploader. "liite" is the name of my file field:
>
> switch($_FILES['liite']['error']){
> case UPLOAD_ERR_INI_SIZE:
> case UPLOAD_ERR_FORM_SIZE:
> echo "File {$_FILES['liite']['name']} upload failed because the
> filesize (".number_format($_FILES['liite']['size']/1024,1)." kb) is too big.
> Please contact administration.";
> break;
> case UPLOAD_ERR_PARTIAL:
> echo "File {$_FILES['liite']['name']} upload failed because file was
> only partially transmitted. Please contact administration.";
> break;
> case UPLOAD_ERR_NO_TMP_DIR:
> case UPLOAD_ERR_CANT_WRITE:
> echo "File {$_FILES['liite']['name']} upload failed because of
> server error. Please contact administration.";
> break;
> case UPLOAD_ERR_OK:
> echo "File {$_FILES['liite']['name']} upload sucessful";
> break;
> case UPLOAD_ERR_NO_FILE:
> default:
> break;
> }
>
> And do check out the manual.
> http://fi.php.net/manual/en/features
~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.com
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
[Back to original message]
|