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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.