> I would like to know if one can save pictures, or movies in a mysql or
> oracle database. If yes, is there any size limit for the file to be
> saved? What's the command used?

You will have to utilize MySQL's BLOB type to store binary data such as
pictures and movies.  Beware of the performance hit storing such binary data
in a database -- it's usually better to store the location of the file in
the database (from a performance standpoint).

Field: image
Type: BLOB

<?
$link = mysql_connect( "localhost", "username", "password" );
mysql_select_db( "images", $link );
$fp = fopen( "myImage.jpg", "r" );
$bvar = fread( $fp, filesize( "myImage.jpg" );
fclose( $fp )
$bvar = addslashes( $bvar );
mysql_query( "INSERT INTO gfx (image) values ('$bvar')", $link );
mysql_close( $link );
?>

As for file size limitations:
BLOB = 64 KB max.
MEDIUMBLOB = 16 MB max.
LONGBLOB = 4 GB max.

Regards,
 Avinesh

================================
Avinesh Bangar, MS, BCIS, SCSA, CCA, A+
Lead Programmer & Network Administrator
Stratabase Inc.
E-mail: [EMAIL PROTECTED]
Web: http://www.stratabase.com
================================



_______________________________________________
ilugd mailing list
[EMAIL PROTECTED]
http://frodo.hserus.net/mailman/listinfo/ilugd

Reply via email to