is it possible to upload (binary) files to a mysql database?
| From: | Sander Peters | Date: | Tue, 18 Jun 2002 20:54:19 +0000 |
| Subject: | is it possible to upload (binary) files to a mysql database? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19868@lists.php.net to get a copy of this message | ||
Hello,
Is it possible to upload binary files to a mysql database?
I can't figure it out. This is what I did:
I made a form like this:
<FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="200000">
Send this file: <INPUT NAME="attachment" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>
My SQL Query is like this:
INSERT INTO ALBUMS ('file') VALUES '$attachment'
The field FILE is a type BLOB field.
The first result I got in the database whas the tempdir+tempfile.
After that I choosed to ad $attachment_name into the database.
But only the filename is stored in the database. Is it not possible to store
files into the database?
What I did now in the script is copying the file $attachment_name to a
share on the local network so that everyone can access files uploaded by
users.
This is not the meaning of it all, it should be stored in the database.
Can somebody help me with this?
Please reply me at: mailto:s.peters@eurovet-ah.com (my
e-mail at work)
Thanks in advance.
Sander Peters