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. Quote Link to comment 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 Quote Link to comment 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/ Quote Link to comment 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 Quote Link to comment 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.