Reply to Re: retrieve image from MySQL with php error

Your name:

Reply:


Posted by Andy Hassall on 06/07/05 01:38

On 6 Jun 2005 15:15:41 -0700, "theonlydrayk@gmail.com" <theonlydrayk@gmail.com>
wrote:

>with :
><?php
>
> include('dbinfo.inc.php');
>
> mysql_connect($localhost,$username,$password);
> @mysql_select_db($database) or die( "Unable to select database");
> $query = "SELECT file,filesize,filetype FROM user WHERE id=1;";
> $result=mysql_query($query);
> mysql_close();
>
> $file=mysql_result($result,0,"file");
> $filesize=mysql_result($result,0,"filesize");
> $filetype=mysql_result($result,0,"filetype");
>
> header('Content-Type: text/plain');
> print $file;
>?>
>it's open a window save as...viewimage.php
>i rename the file to viewimage.jpg it's the image i want to show
>try it maybe it will help
>http://24.203.86.30:8080/viewimage.php

andyh@server:~/tmp$ GET http://24.203.86.30:8080/viewimage.php | hexdump -C -n
128
00000000 20 ff d8 ff e0 00 10 4a 46 49 46 00 01 02 00 00 | ÿØÿà..JFIF.....|
00000010 64 00 64 00 00 ff ec 00 11 44 75 63 6b 79 00 01 |d.d..ÿì..Ducky..|
00000020 00 04 00 00 00 50 00 00 ff ee 00 26 41 64 6f 62 |.....P..ÿî.&Adob|
00000030 65 00 64 c0 00 00 00 01 03 00 15 04 03 06 0a 0d |e.dÀ............|
00000040 00 01 6a a1 00 02 35 06 00 03 ea af 00 07 01 da |..j¡..5...ê¯...Ú|
00000050 ff db 00 84 00 02 02 02 02 02 02 02 02 02 02 03 |ÿÛ..............|
00000060 02 02 02 03 04 03 02 02 03 04 05 04 04 04 04 04 |................|
00000070 05 06 05 05 05 05 05 05 06 06 07 07 08 07 07 06 |................|
00000080

JFIF is supposed to start with the SOI marker "ff d8" - you've got a leading
20 - which is a space character.

Check your source code for a space - I would particularly check dbinfo.inc.php
as there doesn't appear to be a space in the code you posted.

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация