You are here: RE: [PHP] download not working « PHP « IT news, forums, messages
RE: [PHP] download not working

Posted by "Albert" on 12/28/05 15:27

> Ross wrote:
>> $query= "SELECT * FROM publications WHERE alphabet='a'";
>>
>> $result= mysql_query($query);
>> while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){
>>
>> $row['pdf_size'] = $row['pdf_size']/ 1024;
>> $row['pdf_size']= number_format($row['pdf_size'], 0);
>> $size= $row['pdf_size'];
>> $name = str_replace("_", " ", $row['pdf_name']);
>> $name = str_replace(".pdf", "", $name);
>> $link= $row['content'];
>>
>> echo "<span class=\"pdflinks\">$name</span>";
>> echo "&nbsp;&nbsp;";
>> echo "<span class=\"sizes\">($size kb)</span>";
>> //<a href="#">ross</a>
>> ?>
>> download is here......
>> <a href="a-z.php?id=<?=$row['id'];?>">link</a> <br>

You need to make sure that the code above doesn't output anything when
isset($_GET['id']).

>> <?
>>
>> if(isset($_GET['id']))
>> {
>> echo "id is this";

You should not have any output before you send your headers and file
content.

>> $id = $_GET['id'];
>> $query = "SELECT * FROM publications WHERE id = '$id'";
>>
>> $result = mysql_query($query) or die('Error, query failed');
>>
>> $pdf_size=$row['pdf_size'];
>> $pdf_type=$row['pdf_type'];
>> $pdf_name=$row['pdf_name'];

Where does $row come from?

>> ob_clean();
>> header("Content-length: $pdf_size");
>> header("Content-type: $pdf_type");
>> header("Content-Disposition: attachment; filename=$pdf_name");
>> echo $content;

Where does $content come from?



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.8/215 - Release Date: 2005/12/27

 

Navigation:

[Reply to this 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

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