$_FILES[var][size] Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralph Freshour

    $_FILES[var][size] Question

    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

    #2
    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

    Comment

    • nylz

      #3
      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_file size in php.ini is set to 2Mb by
      default. Change it as you like, for example:

      upload_max_file size = 8M


      HTH
      niels

      Comment

      • Ralph Freshour

        #4
        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.i t> 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_file size in php.ini is set to 2Mb by
        >default. Change it as you like, for example:
        >
        >upload_max_fil esize = 8M
        >
        >
        >HTH
        >niels[/color]

        Comment

        • Matthew Vickers

          #5
          Re: $_FILES[var][size] Question

          On Thu, 28 Aug 2003 04:00:25 GMT
          Ralph Freshour <ralph@primemai l.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']




          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

          Comment

          Working...