Uploading an image to a db
| From: | Barajas, Arturo | Date: | Fri, 07 Feb 2003 18:02:22 +0000 |
| Subject: | Uploading an image to a db | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134766@lists.php.net to get a copy of this message | ||
Greetings, people.
I have the following code to upload an image to a db:
if (isset($imgLogo) && $imgLogo != "none")
$data = addslashes(fread(fopen($imgLogo, "r"), filesize($imgLogo)));
else
$data = "";
Then I just "INSERT INTO table (image) VALUES $data" but I think that the string that
contains the image gets truncated somehow. Can anybody tell me why? Is the "addslashes"
really needed? I'm using php 4.2.1.
Thanks in advance.
--
Un gran saludo/Big regards...
Arturo Barajas, Tech Support Supervisor
IT PPG México
(427) 271-9918, x448