Hello gurus,
I have a mysql table with one of field created as "mediumblob". This filed planned to use for saving files uploaded by users through apache+php.
Now I have this insert statement for inserting the file into the fields:
Code:
$data=fread(fopen($file_ln, "rb"), filesize($file_ln));
$query="insert into mes values (\"" . $_SESSION['user_id'] . "\",\"" . $to[$i] . "\",\"" . $_POST['message'] . "\",now(),\"\",\"".$file_name."\",\"".$data."\")";
Where file_ln is the uploaded file.
Now this query works perfectly if a text file is uploaded, but fails when MS-word (or .xls etc) files are uploaded.
The error reported is
Quote:
|
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
What is the problem in this, folks. I feel there is som emismatch between the field type and the $data.
After uploading the .doc file, I have checked that the $data variable does save the file. This I have done by checking its size by "strlen($data)".
Any pointer friends.
Thanks in advance.
Prabhat Soni