Re: upload an image and store it in mysql
| From: | John W. Holmes | Date: | Wed, 14 Jul 2004 23:05:03 +0000 |
| Subject: | Re: upload an image and store it in mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190544@lists.php.net to get a copy of this message | ||
Five wrote:
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')"; -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com