Re: downloading an image
| From: | Ross | Date: | Wed, 11 Apr 2007 14:37:30 +0000 |
| Subject: | Re: downloading an image | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252582@lists.php.net to get a copy of this message | ||
yes it is image/jpeg
"Roberto Mansfield" <robertom@sas.upenn.edu> wrote in message
news:6C.45.18117.1A1FC164@pb1.pair.com...
> Verify that your $type is a correct mime type.
>
>
> 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";
>> }
>> ?>
>> <img src="<?php echo $link; ?>"/>
>>
>>
>>
>> this is the download script
>>
>> id = $_GET['id'];
>> $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;
>>
>> exit;