Page 1 of 1

upload problem

Posted: Sat Dec 18, 2004 9:59 am
by AXEmonster
php 4+
unix/linux
mysql

hi guys

i have a problem with an upload script corrupting tif images on upload. The file size is consistent with the original. I am also using (header. redirect after the upload).

When i download the image only half the image was visible the rest was greyed out. I moved the uploaded image from the upload directory and viewed it with a different application and it was the same so it is the upload process.

i have a test server which is configered the same as the troublesome live server. The test server works fine using the same script. I have also done a compare against conf files on both servers and there is no difference. The max file size is more than enough to handle the files and is the same on both servers. PHP is set up the same on both servers

any ideas

Posted: Mon Dec 20, 2004 4:02 am
by Wayne
Since you have mentioned that mysql is your database, I assume you are storing the image in the database, if this is the case have a look at the mysql variables and check the value of max_allowed_packet. You might also want to save the image as a file and check that doesn't corrupt the image.

Posted: Mon Dec 20, 2004 11:46 am
by AXEmonster
i am sending a file to a directory.
The only mysql insert i am using is to capture the file name

Posted: Mon Dec 20, 2004 1:28 pm
by rehfeld
what exact version of php?


some functions in older versions arent binary safe, and might be causing this problem

fopen() comes to mind. in older versions you need to specify the 'b' flag for binary safe. for example

$fp = fopen('filename.img', 'wb');