I've got a problem uploading a file. I'm uploading it as binary data, and I am therefore using fopen to get the file contents. The script I'm using is as follows:
if ($fileUpload)
{
$picture = addslashes(fread(fopen($fileUpload, "rb"), filesize($fileUpload)));
$picture_type=$fileUpload_type;
echo $picture;
$update_picture_query="UPDATE user SET picture='$picture', picture_type='$picture_type' WHERE username='$username'";
mysql_query($update_picture_query);
}
The script does work when run as part of a script on another page, but when I run it separately, I get the following error messages:
Warning: fopen(U:\Nina\Experimentversioner\Parthenon\medarbetare\competenskraft\bilder\Helena Jönsson.jpg) [function.fopen]: failed to create stream: No such file or directory in E:\www\Parthenon\content_types\user_details.php on line 26
Warning: filesize() [function.filesize]: Stat failed for U:\Nina\Experimentversioner\Parthenon\medarbetare\competenskraft\bilder\Helena Jönsson.jpg (errno=2 - No such file or directory) in E:\www\Parthenon\content_types\user_details.php on line 26
Warning: fread(): supplied argument is not a valid stream resource in E:\www\Parthenon\content_types\user_details.php on line 26
Does anybody have any clues as to where the problem lies?
/Nina