|
Posted by "Ross" on 12/28/05 15:03
The pdf is fine, there are no errors . All I get is a small (130byte) pdf
file which is corrupt when I try and open it.
Thanks,
R.
"Jochem Maas" <jochem@iamjochem.com> wrote in message
news:43B28631.6070904@iamjochem.com...
> are people supposed to smell what is not working?
> do you get any errors? is it possible the PDF was corrupt
> when you uploaded it?
>
> Ross wrote:
>> working form this example
>>
>> http://www.php-mysql-tutorial.com/php-mysql-upload.php
>>
>>
>> my code is as follows, all I get is a corrupt pdf file.....
>>
>> $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 " ";
>> 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>
>> <?
>>
>> if(isset($_GET['id']))
>> {
>> echo "id is this";
>> $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'];
>> ob_clean();
>> header("Content-length: $pdf_size");
>> header("Content-type: $pdf_type");
>> header("Content-Disposition: attachment; filename=$pdf_name");
>> echo $content;
>>
>>
>> exit;
>> }
>> }
>>
[Back to original message]
|