PDA

View Full Version : Changing headers with php error



Zigon
November 16th, 2011, 05:12 PM
I have a button where the user can download a pdf file, instead of opening in their browser. This works on my local server but when when hosted on Yahoo, I receive "500 - Internal Server Error".

index.php:


<a href="../download.php"><img src="../site_images/pdf_icon.png"></a>


download.php:


header('Content-disposition: attachment; filename=n_catalog.pdf');
header('Content-type: application/pdf');
readfile('catalog.pdf');


EDIT: Fixed it by updating the PHP version on the server.

Bachstelze
November 16th, 2011, 06:04 PM
You forgot the PHP openoing tag. ;)


<?php
header('Content-disposition: attachment; filename=n_catalog.pdf');
header('Content-type: application/pdf');
readfile('catalog.pdf');

EDIT: Though if it works on your local server, I guess that's not the problem... Yahoo probably just doesn't let you do that.

Zigon
November 16th, 2011, 06:51 PM
I just forgot to copy them in, they're in there though lol thanks. Ya I guess I'll go contact them.