I have php code that takes text input from a webpage and and stores it in a mysql data base.
I tried uploading small images (jpg) using basically the same syntax but they don't make it into the data base.
Does anyone know of a simple tutorial that shows how to do this?


although I'm against storing files in databases...

$file =
mysql_real_escape_string(file_get_contents($_FILES['yourfile']['tmp_name']));
$query = "INSERT INTO yourtable (imgdata) VALUES ('$file')";


Thanks, that seems to work. Although trying to retrieve them and show them in a 
browser shows characters / symbols instead. This
kind of stuff:

j?w4ëÜ­qÈHæQI'[EMAIL PROTECTED] `Ñ*[#‰j ¥q6Ñ”]Q.b ?Œâ¶(YŒ:9£-"Òª(K\¯'½È ŽÛÃEbXÊê£W(Ìe
9?Æ›¹pã´EXŽaâÑlÑ˵m8=˜±{?ãx´fî ©ÜÎ Lãùy?§ùeñ©±(£Žâ5Œ ¢µPP€‹3›aª —Ãç‰o XŠÓD ~?ûüJ¢
ÜVиܶF&·7´š© cæ[3b䱄C°&EôÐî 


Another reason for not storing images in a database - you need to spit out the correct set of headers before you send the actual image data.



--
Raditha Dissanayake.
---------------------------------------------
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to