You are here: Re: Limit File Size in email form?? « PHP Programming Language « IT news, forums, messages
Re: Limit File Size in email form??

Posted by Kimmo Laine on 07/04/06 06:21

"Jefferis NoSpamme" <jefferisp7@hotmail.com> wrote in message
news:C0CE95E1.44278%jefferisp7@hotmail.com...
> 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???

Assuming your file field looks something like this:
<input type="file" name="myfile">
The error code is, like I explained the first time, in the $_FILES array
under $_FILES['myfile']['error'].

if( $_FILES['myfile']['error']==UPLOAD_ERR_FORM_SIZE ){
echo "too big file";
}

You also get the size of the file in $_FILES['myfile']['size'] which you can
test to see if it's too big. In your case 3 megs = 3*1024*1024 bytes =
3145728

if( $_FILES['myfile']['size'] > 3145728 ){
echo "too big file";
}

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация