Hi,
I've read the article on uploading binary data into a blob field (in this case, uploading images...) on this site and I tried to use the script given with it. T
he problem I'm having is that when I go to open the submitted file, the script crashes out saying it can't find the file.
This is odd because I've also written a script that uploads a file to any given directory (via 'copy'), and this also uses my TEMP directory that I'll assume the file is being stored in while it's being uploaded.
<?php
if ($submit) {
$filein = addslashes(fread(fopen($formfile, "rb"), filesize($formfile)));
MYSQL_CONNECT("localhost","james","biteme");
mysql_select_db("rq");
$result = MYSQL_QUERY("INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) VALUES ('$formdescription','". $filein ."','$formfile_name','$formfile_size','$formfile_type')");
$id = mysql_insert_id(); print "<p><b>Information</b>: '$formfile_name' has been given the ID: <b>$id</b>";
MYSQL_CLOSE();
}
?>
The problem occurs at the fread(fopen()) function - it simply can't read the file, which is what's causing the problem.
Has anyone any suggested solutions?
Thanks & regards,
James.