html - Struggling to display blob image with php -
I am creating a simple website, I want to allow users to upload and change their avatars. Currently I am able to upload images in a mysql database, such as code stored in the form of blobs: // connected to DB, userID has $ image = $ FILES ['fileToUpload'] ['tmp_name']; $ Fp = fopen ($ image, 'r'); $ Content = fread ($ fp, filesize ($ image)); $ Content = addslashes ($ content); Fclose ($ FP); $ Sql = "Update tbUsers SET ProfileVersion = '" $ Content "'UserID =". User ID; $ Result = mysql_query ($ sql) or die (mysql_error ()); After uploading files when I download files from phpmyadmin, they are saved as .bin files, but can be viewed normally. I'm not sure whether this is correct or not my image is displayed as follows: HTML: & lt ;? Php echo '& lt; Img src = "showPic.php? Q = '. $ _SESSION [' Profile ']'" / & gt; ? & Gt; PHP: if (! $ _ GET ['profile']) ...