I'm having big problems getting PHP to load images into a MySQL database. I
can and have loaded images perfectly via other routes but when I try to do
it via PHP the data always ends up corrupted. I don't get any errors but the
binary data is always knackered.
I'm using PHP 4.3.0/Apache 2.0.43 on Windows 2000 and MySQL 4.0.7-gamma
(also tested with MySQL 3.X) running on a linux box. The upload and post max
settings in PHP are both set at 20mb and the size limit to MySQL is also at
20mb. As I said I can load the same files into the database via other routes
The code I'm using is as follows, any ideas what the problem is?
MYSQL_CONNECT("192.168.1.10","loginname","password") or die('Unable to open
mysql_select_db("ImageDB") or die('Unable to select database');
$data = addslashes(fread(fopen($_FILES['UpImg']['tmp_name'], "r"),
$Qry="INSERT INTO Images (ID,Image,mime,size,OrgName)
$result=MYSQL_QUERY($Qry) or die("<P>DB Write Error<P>".mysql_error());
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php