Jump to content

Archived

This topic is now archived and is closed to further replies.

PC Nerd

Dowload link

Recommended Posts

hey
i posted a topic earlier but i still dont get how it is working, with the http protocol ive changed the variable to my file name, but the pages just reads the file, eg displays as though it is just a txt file etc.    ??? ??? ??? ???

how do i force a download, eg, the client downloads the file.  i would probably have it in a zip folder.

all help is greatly appreciated

PC Nerd    ;D

Share this post


Link to post
Share on other sites
the code you had was a force download link when a user went to that page the download happens ok.


so the link was to that page ok.


use this ok

<a href="filename.zip">download file</a

i use this on downloads that are not in my database in a html file .

You want need to force a ziped folder ok.

false download is not a buzz word ok.

Share this post


Link to post
Share on other sites
Hey

thanks, i have had a break from programming today, and i realised that i had put a lowercase instead of uppercase character in the filename. 

sorry for hastling

thanks for your help

PC Nerd

Share this post


Link to post
Share on other sites
test.php

<?php

// load content into var

$filecontent="Some text/code im creating in the script";
$downloadfile="file_name.any_exstention";

header("Content-disposition: attachment; filename=$downloadfile");
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($filecontent));
header("Pragma: no-cache");
header("Expires: 0");

?>


test_result.html

<html>
<title>forcing a down load</title>
<head>
<body>
<a href="test.php">download me</a

</body>
</html>
</head>

Share this post


Link to post
Share on other sites
y would i want to do all the http stuff when the link works fine?????????

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.