| |||||||||||
| |||||||||||
reading image from mysql Posted by fastlife (fastlife), 24 October 2007 Hi,http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html i am using this code with little modification like i have moved // Insert any new image into database code to a separate file. and reading image in a different file. My problem is that it is not showing image instead it is showing me binary data. (I want to print it in the page every time it loads) Please help me Regards, Madhulika Posted by admin (Graham Ellis), 25 October 2007 I'm guessing that you haven't added a call to the PHP header function to set the content type, but without seeing you code that has to be a guess ![]() Posted by fastlife (fastlife), 25 October 2007 thanks for replaying.I am pasting piece code for you to view. <tr> <td width="100%" colspan="3"> <p align="center"><b> <font face="Verdana" size="2" color="#515151">MODIFY USER </font></b></td> </tr> <tr> <td width="8%"> </td> <td width="21%"> </td> <td width="71%"> </td> </tr><? $UID=$_GET[id]; $gotten = @mysql_query("select * from users where user_id=$UID"); if ($row = @mysql_fetch_assoc($gotten)) { $bytes = $row[picture1]; } else { $errmsg = "There is no image in the database yet"; $title = "no database image available"; } if ($_REQUEST[gim] == 1) { header("Content-type: image/jpeg"); print $bytes; exit (); } ?> <input type="hidden" name="txtMenuID" size="60" value="<?=$row["user_id"]?>"> <script language="javascript1.2"> editor_generate('txtDescription1'); </script> <tr> <input type="hidden" name="MAX_FILE_SIZE" value="50000"> <td width="30%" class='style9'>Picture 1</td> <td width="70%"><img src=?gim=1 width=144> <br><input type="file" name="txtPic" size=30> </td> </tr> This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |