Trouble uploading images

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laredotornado@zipmail.com

    #1

    Trouble uploading images

    Hi, I'm using PHP 4 and I am submitting some images in a form with

    <form name=addProduct Form enctype="multip art/form-data" method=post
    action="add_pro duct_response.p hp">
    <input type=file name='prodImg' id='prodImg'>

    However, sometimes, the images fail to upload, even though the form
    submits fine. When I try to print out the values from the
    $_FILES['prodImg'] array, I get

    name: ONDA076.jpg
    type:
    tmp_name:
    error: 3
    size: 0

    What does an error code of 3 mean? I would prefer not to do anything
    to my image (take it to PhotoShop and edit it, etc.). Is there
    something else I can do so that it will upload?

    Thanks, - Dave

  • Andy Hassall

    #2
    Re: Trouble uploading images

    On 18 Dec 2004 12:43:47 -0800, laredotornado@z ipmail.com wrote:
    [color=blue]
    >Hi, I'm using PHP 4 and I am submitting some images in a form with
    >
    ><form name=addProduct Form enctype="multip art/form-data" method=post
    >action="add_pr oduct_response. php">
    ><input type=file name='prodImg' id='prodImg'>
    >
    >However, sometimes, the images fail to upload, even though the form
    >submits fine. When I try to print out the values from the
    >$_FILES['prodImg'] array, I get
    >
    >name: ONDA076.jpg
    >type:
    >tmp_name:
    >error: 3
    >size: 0
    >
    >What does an error code of 3 mean? I would prefer not to do anything
    >to my image (take it to PhotoShop and edit it, etc.). Is there
    >something else I can do so that it will upload?[/color]



    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • Tommy Gildseth

      #3
      Re: Trouble uploading images

      laredotornado@z ipmail.com wrote:
      [color=blue]
      > Hi, I'm using PHP 4 and I am submitting some images in a form with[/color]
      .....[color=blue]
      > However, sometimes, the images fail to upload, even though the form
      > submits fine. When I try to print out the values from the
      > $_FILES['prodImg'] array, I get
      >
      > name: ONDA076.jpg
      > type:
      > tmp_name:
      > error: 3
      > size: 0
      >
      > What does an error code of 3 mean? I would prefer not to do anything
      > to my image (take it to PhotoShop and edit it, etc.). Is there
      > something else I can do so that it will upload?[/color]

      This suggests that the file is to large for your current configuration.

      There are at least 2 config settings that is worth looking at:
      upload_max_file size
      PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

      This value can only be changed in php.ini, httpd.conf (asuming you're using
      apache), or a .htaccess file.

      The second setting is:
      post_max_size
      PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

      This value can only be changed the same places as upload_max_file size.

      --
      Tommy

      Comment

      • laredotornado@zipmail.com

        #4
        Re: Trouble uploading images

        Thanks for the advice. I don't have control over the php.ini file, but
        I tried adding these settings

        // set max file upload sizes
        ini_set("upload _max_filesize", "10M");
        ini_set("post_m ax_size", "12M");

        This is well above what the size of the file I'm uploading. However, I
        get the same result. Apache is the web server. I have a hunch the web
        server is cutting me off. What would the .htaccess file look like
        since I also don't have control over the httpd.conf file?

        Thanks again, - Dave

        Tommy Gildseth wrote:[color=blue]
        > laredotornado@z ipmail.com wrote:
        >[color=green]
        > > Hi, I'm using PHP 4 and I am submitting some images in a form with[/color]
        > ....[color=green]
        > > However, sometimes, the images fail to upload, even though the form
        > > submits fine. When I try to print out the values from the
        > > $_FILES['prodImg'] array, I get
        > >
        > > name: ONDA076.jpg
        > > type:
        > > tmp_name:
        > > error: 3
        > > size: 0
        > >
        > > What does an error code of 3 mean? I would prefer not to do[/color][/color]
        anything[color=blue][color=green]
        > > to my image (take it to PhotoShop and edit it, etc.). Is there
        > > something else I can do so that it will upload?[/color]
        >
        > This suggests that the file is to large for your current[/color]
        configuration.[color=blue]
        >
        > There are at least 2 config settings that is worth looking at:
        > upload_max_file size
        >[/color]
        http://www.php.net/manual/en/ini.sec...d-max-filesize[color=blue]
        > This value can only be changed in php.ini, httpd.conf (asuming you're[/color]
        using[color=blue]
        > apache), or a .htaccess file.
        >
        > The second setting is:
        > post_max_size
        >[/color]
        http://www.php.net/manual/en/ini.sec....post-max-size[color=blue]
        > This value can only be changed the same places as[/color]
        upload_max_file size.[color=blue]
        >
        > --
        > Tommy[/color]

        Comment

        • Tommy Gildseth

          #5
          Re: Trouble uploading images

          laredotornado@z ipmail.com wrote:
          [color=blue]
          > Thanks for the advice. I don't have control over the php.ini file, but
          > I tried adding these settings
          >
          > // set max file upload sizes
          > ini_set("upload _max_filesize", "10M");
          > ini_set("post_m ax_size", "12M");
          >[/color]

          No, as I said. you can't set these values using ini_set(), since they have
          to be set, before the script is run.
          [color=blue]
          > This is well above what the size of the file I'm uploading. However, I
          > get the same result. Apache is the web server. I have a hunch the web
          > server is cutting me off. What would the .htaccess file look like
          > since I also don't have control over the httpd.conf file?[/color]

          put this in your .htaccess file:
          php_value post_max_size 22M
          php_value upload_max_file size 10M


          This may or may not work, depending on the restrictions your webhost has set
          in the httpd.conf file, with regards to what you may do in the .htaccess
          file.

          --
          Tommy

          Comment

          Working...