Forum Moderators: coopster

Message Too Old, No Replies

php allow download of a .zip file if logged in

         

icpooreman

7:30 pm on May 18, 2006 (gmt 0)

10+ Year Member



for a msword file I would put
function to check if logged in;
header('Content-type: application/msword');
print file_get_contents("Path://document.doc");

but with a .zip file I'm assuming the two lines would change and I have no idea what to change them to.

jatar_k

7:50 pm on May 18, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try the comments on the manual page for header

[php.net...]

looks like
application/zip

the file_get_contents just needs the path to the file

icpooreman

8:38 pm on May 18, 2006 (gmt 0)

10+ Year Member



It works what I had to do was have the following two lines for the header before the print statement thanks for the link.

header("Content-Type: application/zip");
header('Content-Disposition: attachment; filename="downloaded.zip"');

jatar_k

8:41 pm on May 18, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



nice work