|
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]
|