Storing binary files in a MySQL table
Posted: Thu Sep 04, 2003 6:59 am
Hi there,
I am working around with a medium-sized CMS based on MySQL and PHP. One of the backend modules needs a new feature - a possibility to upload & store binary files (Images, PDF's, Excel Sheets, Word Files, HTML Files, ...) in a DB table.
They should NOT be displayed on any website but be downloadable for a certain range of users.
I know about the basics
and I have a "longblob" field named "p113" in the destination table.
But every time I select a file and run the insert script, NOTHING is stored in my BLOB field
- without any error_messages in the apache logs. The rest of the information to store is written to the DB as desired.
What am I doing wrong? Any ideas or suggestions are welcome. By the way: how can i fetch the addiotinal file informations like size etc. automatically and store them with the filke itself?
Greez, bluenote
I am working around with a medium-sized CMS based on MySQL and PHP. One of the backend modules needs a new feature - a possibility to upload & store binary files (Images, PDF's, Excel Sheets, Word Files, HTML Files, ...) in a DB table.
They should NOT be displayed on any website but be downloadable for a certain range of users.
I know about the basics
Code: Select all
<?php
echo "<FORM NAME="insert" ACTION="insert.php" METHOD="POST" onSubmit="return chkinsert()" onreset="return confirmReset(this)" ENCTYPE="multipart/form-data">\n";
?>Code: Select all
<?php
echo "<INPUT TYPE="HIDDEN" NAME="MAX_FILE_SIZE" VALUE="31457280">\n";
echo "<INPUT TYPE=file NAME="p113" VALUE="" SIZE=40>\n";
?>But every time I select a file and run the insert script, NOTHING is stored in my BLOB field
What am I doing wrong? Any ideas or suggestions are welcome. By the way: how can i fetch the addiotinal file informations like size etc. automatically and store them with the filke itself?
Greez, bluenote