strange problem with var holding file contents
Posted: Wed Aug 20, 2003 5:19 pm
I am having this strange problem with a script that I wrote. It was working for about a year until I updated my server last night. The script takes the contents of an image file and stores it in a database for later use.
for some reason, it is only taking 16KB of the file now. I've done a few tests using strlen() and commenting out the unlink() to see what is happening and it seems to just stop reading the file at 16KB (actually 16,008 characters). The entire file makes it to the temporary directory. I've downloaded them from there and opened them to verify that.
It is very perplexing to me that updating the server would stop this script from working. Do any of you know what could be causing this? Did I set something wrong in php.ini or something in httpd.conf or something crazy like that?
Please help. My boss is a little upset about this.
Thanks in advance,
Ben
Code: Select all
// Set the maximum file size
$max_file_size = (1024 * 1024 * 2); // 2MB
// Read the file contents into the variable
$bin_data = fread($fp, $max_file_size);
fclose($fp);
// Escape special characters in the file
$bin_data = addslashes($bin_data);
if (!unlink($new_img_location))
echo "Unable to unlink $img.<br><br>\n";It is very perplexing to me that updating the server would stop this script from working. Do any of you know what could be causing this? Did I set something wrong in php.ini or something in httpd.conf or something crazy like that?
Please help. My boss is a little upset about this.
Thanks in advance,
Ben