Re: Storing Img Binary in MySQL

From: Date: Thu, 06 Dec 2001 11:03:43 +0000
Subject: Re: Storing Img Binary in MySQL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-76854@lists.php.net to get a copy of this message
mysql_query('INSERT INTO the_table (name,content) VALUES(".$HTTP_POST_FILES['ImgFile']['name'],',', mysql_escape_string(implode('',file($HTTP_POST_FILES['ImgFile']['tmp_name']))).');'); you can use addslashes also but mysql_escape_string is safer. Regards, Andrey Hristov ----- Original Message ----- From: "phantom" <phantom@phantomcougar.com> To: <php-general@lists.php.net> Sent: Thursday, December 06, 2001 12:48 PM Subject: [PHP] Storing Img Binary in MySQL > I want to store the image binary data in a MySQL Blob field. So I > created a simple form that prompted the client for an image file that > would be uploaded to the server. > > The server takes the file and gets the following data, assuming ImgFile > is the name of the uploaded image. > > $ImgTitle = $HTTP_POST_FILES['ImgFile']['name']; > $ImgType = $HTTP_POST_FILES['ImgFile']['type']; > $ImgSize = $HTTP_POST_FILES['ImgFile']['size']; > > When I go to save $ImgFile into MySQL is is actually saving the name of > the temporary location of that file on my server and not the binary data > that compose that image. This does not surprise I knew this much at > least. > > So how do I get the Binary DATA to save and not the temp file location? > > Thx. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#76854) next »