doddsey_65 Posted May 10, 2010 Share Posted May 10, 2010 When the user clicks on the link i want it to open the download file dialog box so the user can download the file. Instead it opens the file in the browser. What am i doing wrong? Here is my code. <?php echo 'Attachment - <a href="ftp://thevault.000a.biz/swn/'.$row->attachment.'">'.$row->attachmentname.'</a>'; ?> $row->attachment is the filepath of the file on the server and $row->attachmentname is the name the user inputs. Link to comment https://forums.phpfreaks.com/topic/201303-href-download-link/ Share on other sites More sharing options...
iblood Posted May 10, 2010 Share Posted May 10, 2010 hope this helps... create a new page, which will be your download page.. then use this snippet => http://php.net/manual/en/function.readfile.php Link to comment https://forums.phpfreaks.com/topic/201303-href-download-link/#findComment-1056154 Share on other sites More sharing options...
haku Posted May 11, 2010 Share Posted May 11, 2010 This is the best 'force download' script I have found so far: http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/ Link to comment https://forums.phpfreaks.com/topic/201303-href-download-link/#findComment-1056232 Share on other sites More sharing options...
doddsey_65 Posted May 11, 2010 Author Share Posted May 11, 2010 Hi, just found out my free host does not allow the rar extension. Its a good thing im making this for someone else and will be uploading it to there host soon. Thanks Link to comment https://forums.phpfreaks.com/topic/201303-href-download-link/#findComment-1056461 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.