Image Upload Script != Working



Hi guys,
I am using an image uploading script on my site. It was working fine on my home server running ubuntu with apache2 and php5. When I uploaded to dreamhost it no longer worked, it just gives me a blank page when I submit an image and the image is not uploaded. I assumed it was because of the extra security dreamhost has so I went into my domain settings and unchecked enable extra security, I waited a few hours and tried again and it still failed miserably giving me the same exact white page with no error or anything. I tried enabling FastCGI as I had read in other posts, it didn’t help at all, still white page. The URL is for testing purposes I left it unpassworded. I have also checked permissions on all folders that it uploads to and such and there is no problem there.


Bear in mind that you cannot use a PHP script to upload images with large file sizes. Annoyingly, the maximum upload size of 10Mb is still smaller than the default file size output by many digital cameras.

Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


None of the images I have uploaded are even close to being that big, they are all under 2mb or so. I have posted part of the script here index.php/txt submits to index2.php/txt. I have figured out that it is failing because the HTTP_POST_FILES variable in index2.php/txt isn’t being set to anything. When I run it on my server there is data about the image etc.


I have fixed my problem, php5 didn’t like it for some reason, the variables weren’t being set so I just switched it to php4 and it worked fine.


Switching to PHP4 is not a proper solution. The problem lies with the fact that you are using deprecated superglobal array variables. You should be using the $_FILES array instead. For more information, see this page of the DreamHost wiki:

Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]