PC Nerd Posted July 2, 2006 Share Posted July 2, 2006 heyi 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 appreciatedPC Nerd ;D Quote Link to comment https://forums.phpfreaks.com/topic/13439-dowload-link/ Share on other sites More sharing options...
redarrow Posted July 2, 2006 Share Posted July 2, 2006 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</ai 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. Quote Link to comment https://forums.phpfreaks.com/topic/13439-dowload-link/#findComment-51921 Share on other sites More sharing options...
PC Nerd Posted July 2, 2006 Author Share Posted July 2, 2006 Heythanks, 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 hastlingthanks for your helpPC Nerd Quote Link to comment https://forums.phpfreaks.com/topic/13439-dowload-link/#findComment-51923 Share on other sites More sharing options...
redarrow Posted July 2, 2006 Share Posted July 2, 2006 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> Quote Link to comment https://forums.phpfreaks.com/topic/13439-dowload-link/#findComment-51925 Share on other sites More sharing options...
PC Nerd Posted July 2, 2006 Author Share Posted July 2, 2006 y would i want to do all the http stuff when the link works fine????????? Quote Link to comment https://forums.phpfreaks.com/topic/13439-dowload-link/#findComment-51930 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.