On Mon, February 5, 2007 4:29 pm, Robert Fitzpatrick wrote: > I have a small application that ran on one server and now gives me a > problem with uploading images on a new server. I am running PHP 4.4.4 > now on this server and hoping it is just something that needs adjusted > in php.ini, but cannot seem to find. The file is posted as a file > fields > in a multipart/form-data form, the application tests the file with > getimagesize() shown below. I am getting the die response in the > browser. I tried echo of the file and it prints a random file name > under > the /tmp directory on this CentOS Linux system. If I sleep for 10 > seconds, the file gets created and gone after the script finishes. Can > someone suggest what my problem may be? The file always goes away when the script finishes. See: http://php.net/move_uploaded_file > if (!getimagesize($_FILES['filPhoto']['tmp_name'])) { > die('The file you are attempting to upload is not an image file.'); Try various things like file_exists on the file to see if you are getting the file at all. fopen/fread the first N bytes and compare them to what you are uploading, to see if the data that gets there is the data you sent. getimagesize() only reads the first N bytes and then interprets that to decide what kind of file it is, and how big the width/height are, etc. I dunno exactly what N is, but it's relatively small. Different file formats have different size N, and PHP has to figure out what to do for all of them, so maybe it just reads the largest N, or maybe it reads a few bytes and then decides how many to read for the rest of the meta-info. At any rate, if you can fread a couple hundred bytes, and it matches what you uploaded, then you know that something is wrong with the original image and getimagesize() -- You could FTP it up just like your logo or buttons, and use getimagesize() on it, and it STILL wouldn't work. Actually, that's another good test to run: FTP the file up to your images directory and see what getimagesize does on that. > } else { > <snip> -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php