I copied all my sites over to my new laptop with winxp, but the image uploads seem to be corrupting the files. I uploaded a 64b gif, which uploaded as 59b, and won't open in anything.
Could this be a php bug, or am I missing something that I did on my old machine?
Here's my code:
list($filename, $fileext) = explode(".", basename($upfile_name));
$file = $filename . '.' . $fileext;
if (file_exists($DOCUMENT_ROOT . '/dbimages/' . $file)) {
$i = 0;
while(file_exists($DOCUMENT_ROOT . '/dbimages/' . $file)) {
$i++;
$file = $filename . '(' . $i . ').' . $fileext;
}
}
$rfp = fopen($upfile, 'r');
$wfp = fopen($DOCUMENT_ROOT . '/dbimages/' . $file, 'w');
fwrite($wfp, fread($rfp, filesize($upfile)));
fclose($wfp);
fclose($rfp);