Bluehost.com Web Hosting $6.95

Trouble uploading images

This is a discussion on Trouble uploading images within the PHP Language forums, part of the PHP Programming Forums category; Hi, I'm using PHP 4 and I am submitting some images in a form with <form name=addProductForm ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-18-2004
laredotornado@zipmail.com
 
Posts: n/a
Default Trouble uploading images

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

<form name=addProductForm enctype="multipart/form-data" method=post
action="add_product_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?

Thanks, - Dave

Reply With Quote
  #2 (permalink)  
Old 12-18-2004
Andy Hassall
 
Posts: n/a
Default Re: Trouble uploading images

On 18 Dec 2004 12:43:47 -0800, laredotornado@zipmail.com wrote:

>Hi, I'm using PHP 4 and I am submitting some images in a form with
>
><form name=addProductForm enctype="multipart/form-data" method=post
>action="add_product_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?


http://uk2.php.net/manual/en/feature...oad.errors.php

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Reply With Quote
  #3 (permalink)  
Old 12-19-2004
Tommy Gildseth
 
Posts: n/a
Default Re: Trouble uploading images

laredotornado@zipmail.com wrote:

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

.....
> 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?


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_filesize
http://www.php.net/manual/en/ini.sec...d-max-filesize
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
http://www.php.net/manual/en/ini.sec....post-max-size
This value can only be changed the same places as upload_max_filesize.

--
Tommy

Reply With Quote
  #4 (permalink)  
Old 12-19-2004
laredotornado@zipmail.com
 
Posts: n/a
Default 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_max_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:
> laredotornado@zipmail.com wrote:
>
> > Hi, I'm using PHP 4 and I am submitting some images in a form with

> ....
> > 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?

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

http://www.php.net/manual/en/ini.sec...d-max-filesize
> 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
>

http://www.php.net/manual/en/ini.sec....post-max-size
> This value can only be changed the same places as

upload_max_filesize.
>
> --
> Tommy


Reply With Quote
  #5 (permalink)  
Old 12-19-2004
Tommy Gildseth
 
Posts: n/a
Default Re: Trouble uploading images

laredotornado@zipmail.com wrote:

> 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_max_size", "12M");
>


No, as I said. you can't set these values using ini_set(), since they have
to be set, before the script is run.

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


put this in your .htaccess file:
php_value post_max_size 22M
php_value upload_max_filesize 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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 02:34 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0