Hi okie heres a snippet of my php code:
the code below takes a file uploaded from the web with $file as declared filename on
the form.
if ($file_size>0) { //check whether the file is not empty
$data = addslashes(fread(fopen($file, "r"), filesize($file))); //read the file and
add neccessary quotes
$SQL="Insert into Files (Filename,Filetype,Filesize,data) values
('$file_name','$file_type','$file_size','$data')"; //SQL commands to insert into table
named 'FILES'
$result = mysql_query ($SQL)
or die ("ERROR Uploading File:".mysql_errno().": ".mysql_error()."<BR>$SQL");
}
okie hope that helps!
Teddy
"Robert C. Paulsen Jr." wrote:
> On Sat, Feb 03, 2001 at 10:20:07PM +0800, Teddy A Jasin wrote:
> > I have the scripts in php to do this if u want.
>
> Yes, that would help! thanks.
>
> >
> > "Robert C. Paulsen Jr." wrote:
> >
> > > How can I put binary data into a MySQL database?
> > >
> > > I assume the data type is blob, but I don't see how I can
> > > use SQL syntax to insert anything but text data. I would
> > > like to include various binary files (tar files, zip files,
> > > image files, etc.).
> > >
>
> --
> ____________________________________________________________________
> Robert Paulsen [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php