Jump to content

Dowload link


PC Nerd

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

Link to comment
https://forums.phpfreaks.com/topic/13439-dowload-link/
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.

Link to comment
https://forums.phpfreaks.com/topic/13439-dowload-link/#findComment-51921
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>
Link to comment
https://forums.phpfreaks.com/topic/13439-dowload-link/#findComment-51925
Share on other sites

Archived

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

×
×
  • Create New...

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.