Jump to content


Photo

Dowload link


  • Please log in to reply
4 replies to this topic

#1 PC Nerd

PC Nerd
  • Members
  • PipPipPip
  • Advanced Member
  • 1,122 posts
  • LocationAustralia

Posted 02 July 2006 - 08:41 AM

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



#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 July 2006 - 09:07 AM

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.


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 PC Nerd

PC Nerd
  • Members
  • PipPipPip
  • Advanced Member
  • 1,122 posts
  • LocationAustralia

Posted 02 July 2006 - 09:15 AM

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


#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 02 July 2006 - 09:20 AM

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>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 PC Nerd

PC Nerd
  • Members
  • PipPipPip
  • Advanced Member
  • 1,122 posts
  • LocationAustralia

Posted 02 July 2006 - 09:35 AM

y would i want to do all the http stuff when the link works fine?????????





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users