Re: downloading an image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ross wrote:
> tthe image does not display although it exists in the table 'images'
> 
> 
> This calls the download script
> 
> 
> <?
>  $property_id = $_SESSION['property_id'] ;
>  $query = "SELECT * FROM images WHERE property_id='$property_id'";
> $result = mysql_query($query);
> while($row = mysql_fetch_array($result, MYSQL_ASSOC))
> {
> 
> echo $id= $row['id'];
> echo $title= $row['title'];
> $link = "download.php?id=$id";
> }

what do you see when you stick the src url
in the address bar of your browser?
and what response headers do you get from the download.php?


> ?>
> <img src="<?php echo $link; ?>"/>
> 
> 
> 
> this is the download script
> 
> id = $_GET['id'];

$id = $_GET['id'];
^
|
\- missing $ ???


and then your not doing any input cleaning:

if (!isset($_GET['id']) || (($id = intval($_GET['id'])) < 1))
	die('eat **** and die');

> $query = "SELECT name, type, size, content FROM images WHERE id ='$id'";
> 
>  $result = mysql_query($query) or die(mysql_error());
> list($name, $type, $size, $content) = mysql_fetch_array($result);
> 
> header("Content-length: $size");
> header("Content-type: $type");
> 
> echo $content;

and does $content actually contain image data?

> 
> exit; 
> 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux