Re: server error or script error

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

 



On Thu, March 8, 2007 3:38 am, Ross wrote:
> <?php
>
> include ('../phpscripts/connect.php');
> $id = $_GET['id'];
>
> $query = "SELECT * FROM mypdfs WHERE id =$id";
>
> $result= mysql_query($query) or die('Error, query failed');
>
> if (!mysql_num_rows($result))
> {
>    die("No matching records were found in the database.");
> }
>
>
>    while  ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
>
>   $size=$row['pdf_size'];
>    $type=$row['pdf_type'];
> $name=$row['pdf_name'];
>    $content=$row['content'];
>
> header("Content-length: $size");
> header("Content-type: $type");
> header("Content-Disposition: attachment; $name; ");
> echo $content;
> }
>
>
> ?>
>
> I use this script but is had sudenly stop working. I think it is a
> config
> change on the remote server. The porblem is the file either doesn't
> open or
> downloads as download.php
>
> Can anyone suggest a way to improve this script or debug to fins out
> if it
> is a script error or server error.

Are you trying to force them to DOWNLOAD the PDF, or do you want it to
open up in their PDF viewer of choice, often the embedded PDF viewer
of the browser?

If you want to force a download and get the filname right, read my rant.

If you want to just open the PDF up in the browser, lose the
Content-disposition attachment stuff, as that's a late-comer's way of
trying (and failing sometimes) to force a download.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
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