Connecting Tech Pros Worldwide Forums | Help | Site Map

$_FILES[var][size] Question

Ralph Freshour
Guest
 
Posts: n/a
#1: Jul 17 '05
I'm uploading a file to the server - I check the $_FIILES[var][size]
variable to check for exceeding a certain limit (250KB in this case) _
I notice that when I try to upload files of 500KB or 900KB [size]
holds the value and I can check it - however, if I try to upload a
2300KB file [size] is 0 - does anyone know what might be causing this?
Why doesn't that large of a file also get recorded in the [size]
variable?

Thanks...


Karl-Heinz Marbaise
Guest
 
Posts: n/a
#2: Jul 17 '05

re: $_FILES[var][size] Question


Hi Ralph,
[color=blue]
> I'm uploading a file to the server - I check the $_FIILES[var][size]
> variable to check for exceeding a certain limit (250KB in this case) _
> I notice that when I try to upload files of 500KB or 900KB [size]
> holds the value and I can check it - however, if I try to upload a
> 2300KB file [size] is 0 - does anyone know what might be causing this?
> Why doesn't that large of a file also get recorded in the [size]
> variable?[/color]
The problem seemed to be the upload limit of 2MB which is
default in PHP.ini.
Kind Regards.

Karl Heinz
--
Dipl.Ing.(FH) Karl Heinz Marbaise | Minkenberg Medien GmbH
Projektleiter | www.minkenberg-medien.de
Tel.: +49 (2452) 98 91 40 | Roermonderstr. 128a
Fax.: +49 (2452) 98 91 42 | D-52525 Heinsberg

nylz
Guest
 
Posts: n/a
#3: Jul 17 '05

re: $_FILES[var][size] Question


Ralph Freshour wrote:
[color=blue]
> I'm uploading a file to the server - I check the $_FIILES[var][size]
> variable to check for exceeding a certain limit (250KB in this case) _
> I notice that when I try to upload files of 500KB or 900KB [size]
> holds the value and I can check it - however, if I try to upload a
> 2300KB file [size] is 0 - does anyone know what might be causing this?
> Why doesn't that large of a file also get recorded in the [size]
> variable?
>
> Thanks...
>[/color]

that's indeed because upload_max_filesize in php.ini is set to 2Mb by
default. Change it as you like, for example:

upload_max_filesize = 8M


HTH
niels

Ralph Freshour
Guest
 
Posts: n/a
#4: Jul 17 '05

re: $_FILES[var][size] Question


Is there anyway to detect when someone has tried to upload file
exceeding the php.ini limit of 2MB? I noticed that
$_FILES[filename][size] == 0 if there is no file selected or if a file
was selected and it exceeds 2MB - I've tried using the time() function
but the differences was very small between loading no file and loading
a 2MB+ file - I'd like to detect the difference so I can display a msg
to the user accordingly...


On Wed, 27 Aug 2003 16:02:07 +0200, nylz <nylz@email.it> wrote:
[color=blue]
>Ralph Freshour wrote:
>[color=green]
>> I'm uploading a file to the server - I check the $_FIILES[var][size]
>> variable to check for exceeding a certain limit (250KB in this case) _
>> I notice that when I try to upload files of 500KB or 900KB [size]
>> holds the value and I can check it - however, if I try to upload a
>> 2300KB file [size] is 0 - does anyone know what might be causing this?
>> Why doesn't that large of a file also get recorded in the [size]
>> variable?
>>
>> Thanks...
>>[/color]
>
>that's indeed because upload_max_filesize in php.ini is set to 2Mb by
>default. Change it as you like, for example:
>
>upload_max_filesize = 8M
>
>
>HTH
>niels[/color]

Matthew Vickers
Guest
 
Posts: n/a
#5: Jul 17 '05

re: $_FILES[var][size] Question


On Thu, 28 Aug 2003 04:00:25 GMT
Ralph Freshour <ralph@primemail.com> wrote:
[color=blue]
> Is there anyway to detect when someone has tried to upload file
> exceeding the php.ini limit of 2MB?[/color]

Use: $_FILES['userfile']['error']

http://au.php.net/features.file-upload
http://au.php.net/manual/en/features...oad.errors.php

Matt

<SNIP>


--
Quispiam Power Computing | "There are two major products that come out
Pendle Hill, Australia | of Berkeley: LSD and UNIX. We don't believe
+61 2 9688 2894 | this to be a coincidence. "
www.quispiam.com | - Jeremy S. Anderson
Closed Thread