upload problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AXEmonster
Forum Commoner
Posts: 34
Joined: Fri Sep 05, 2003 11:27 am
Location: newcastle UK

upload problem

Post 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
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post 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.
AXEmonster
Forum Commoner
Posts: 34
Joined: Fri Sep 05, 2003 11:27 am
Location: newcastle UK

Post by AXEmonster »

i am sending a file to a directory.
The only mysql insert i am using is to capture the file name
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post 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');
Post Reply