pspsully
05-08-2006, 12:54 PM
I have a script that is supposed to upload an image to an SQL database, here is the code i used for uploading the image:
$handle = fopen($image,'r');
$file_content = fread($handle,filesize($image));
fclose($handle);
$encoded = chunk_split(base64_encode($file_content));
This code works fine on my own PC but when i use it on my my hosting account, i get the following error:
Warning: fopen(C:\\Documents and Settings\\sosullivan\\Desktop\\fire.bmp): failed to open stream: No such file or directory in /home/betawebd/public_html/admin/addprojects.php on line 74
Warning: filesize(): Stat failed for C:\\Documents and Settings\\sosullivan\\Desktop\\fire.bmp (errno=2 - No such file or directory) in /home/betawebd/public_html/admin/addprojects.php on line 75
Warning: fread(): supplied argument is not a valid stream resource in /home/betawebd/public_html/admin/addprojects.php on line 75
Warning: fclose(): supplied argument is not a valid stream resource in /home/betawebd/public_html/admin/addprojects.php on line 76
Ive tried using stripslashes() to make the directory look like this:
C:\Documents and Settings\sosullivan\Desktop\fire.bmp
But i still get the same error!!
Can anyone help me??
Thanks
$handle = fopen($image,'r');
$file_content = fread($handle,filesize($image));
fclose($handle);
$encoded = chunk_split(base64_encode($file_content));
This code works fine on my own PC but when i use it on my my hosting account, i get the following error:
Warning: fopen(C:\\Documents and Settings\\sosullivan\\Desktop\\fire.bmp): failed to open stream: No such file or directory in /home/betawebd/public_html/admin/addprojects.php on line 74
Warning: filesize(): Stat failed for C:\\Documents and Settings\\sosullivan\\Desktop\\fire.bmp (errno=2 - No such file or directory) in /home/betawebd/public_html/admin/addprojects.php on line 75
Warning: fread(): supplied argument is not a valid stream resource in /home/betawebd/public_html/admin/addprojects.php on line 75
Warning: fclose(): supplied argument is not a valid stream resource in /home/betawebd/public_html/admin/addprojects.php on line 76
Ive tried using stripslashes() to make the directory look like this:
C:\Documents and Settings\sosullivan\Desktop\fire.bmp
But i still get the same error!!
Can anyone help me??
Thanks