Importing binary file into MySQL

admin

Administrator
Staff member
I have searched all over, but cannot find a way to import a binary file into a column of a MySQL database's table.

Consider the following table called MYDAT.

MYDAT_ID NOT NULL INT(8)
MYDAT_FILETYPE NOT NULL VARCHAR2(32)
MYDAT_RAWDATA BLOB

I want to import a file that someone uploads (through a FORM upload, which works fine)... say a GIF image. Then have the unique id, the file's type, and the CONTENTS of the file into the MYDAT_RAWDATA field. Is this possible with MySQL using PHP?

MySQL has some sort of import command, but that is not useful for binary data, as it expects CSV style records from the file.
 
Back
Top