Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirection to PDF is returning error message?

Status
Not open for further replies.

Apollo6

Technical User
Jan 27, 2000
418
US
I have managed to get the script to display an existing PDF report using the following redirection code:

{
//Redirect browser to display selected report.
$new_url = $row["rpt_path"];
header("Refresh: 1; url=$new_url");
}

From other post I have read, etc..., I should be able to use the following code:

{
//Redirect browser to display selected report.
$new_url = $row["rpt_path"];
header("Location: $new_url");
}

When I use this code, I get a message box in the browser stating "The file is damaged and cannot be repaired." And basically, I get a blank screen.

I can see that the url is correct for the desired report in the browser. I can copy the url, open a new window and paste the url in and it works. So I know that the file is not damaged or corrupt.

Any ideas or suggestions? If additional information is needed, let me know.
 
I probably should just wait until someone who knows what they're talking about answers... but in the meantime, maybe try...

header("Content-type: application/pdf");

-Rob
 
skiflyer,

I tried the following:

{
//Redirect browser to display selected report.
$new_url = $row["rpt_path"];
header("Content-type: application/pdf");
header("Location: $new_url");
}

Same results... Is this how I should have inserted your suggestion into the block?
 
That's what I was thinking... but like I said, I wasn't so sure. Ah well, worth a shot, now lets wait for someone who's done this one.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top