RE: help with file downloads from MySQL

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

 



Mickey Martin wrote:

> I guessed that 0a is the code for a new line, but cannot find where it is
> in my code. This is the entire code that I'm using for the download:
> 
> <?php
> if ($id_files) {
> 
> mysql_select_db($database_ctnwww, $ctnwww);
> $query_Attachment = sprintf("SELECT bin_data, filetype, filename, filesize
> FROM IssueAttach WHERE id_files=%s", $_GET['id_files']);
> $Attachment = mysql_query($query_Attachment, $ctnwww) or
> die(mysql_error()); $row_Attachment = mysql_fetch_array($Attachment);
> 
>   $data = $row_Attachment['bin_data'];
>   $name = $row_Attachment['filename'];
>   $size = $row_Attachment['filesize'];
>   $type = $row_Attachment['filetype'];
> 
>   header("Content-type: $type");
>   header("Content-length: $size");
>   header("Content-Disposition: attachment; filename=\"$name\"");
>   header("Content-Description: PHP Generated Data");
>   echo $data;
> }
> ?>
> 
> I have also tried putting a string in front of the file on the echo line:
> echo "TEST TEXT", $data;
> 
> When the file is saved, it begins with 0a followed by TEST TEXT and then
> the start of the file without another instance of 0a.
> 
> Mickey
> 
> 
> -----Original Message-----
> From: Oskar [mailto:oki2003@xxxxxxxx]
> Sent: Friday, March 24, 2006 1:59 AM
> To: Mickey Martin; PHP db
> Subject: Re:  help with file downloads from MySQL
> 
> Mickey Martin wrote:
> 
>> From what I can tell, the 0a is not in the file, but is being inserted
>>either with the echo or by the browser when it receives the file. Does
>>anyone know if a proxy server would cause this? There shouldn't be one
>>involved, but I am going to contact my IT department to find out how it
>>is configured today.
>>
>>Thanks,
>>Mickey
>>  
>>
>>
>>  
>>
> 0a is new line character code. Check your script you must be somewhere
> displaying it.

For a wild guess - is <?php the first line in your script? If there is an
empty line above it, that could cause the extra EOL character.



Cheers
-- 
David Robley

My other car is a broom!
Today is Prickle-Prickle, the 11st day of Discord in the YOLD 3172

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux