fredted40x Posted September 16, 2010 Share Posted September 16, 2010 Hi, Just looking how to create a link to download a file located on the server, it will be files like .doc etc. Cant seem to find anything on the net so i think i need php but may be html. Can anyone point me in the right direction? Thanks p.s. it will be used for more than one file so im looking for a small ish amount of code. Quote Link to comment Share on other sites More sharing options...
micah1701 Posted September 16, 2010 Share Posted September 16, 2010 <a href="/path/to/your/file.doc">Download File</a> Quote Link to comment Share on other sites More sharing options...
fredted40x Posted September 16, 2010 Author Share Posted September 16, 2010 Is it that simple. Thought i tried that a while ago. Do you have to put www.etc in or can it just be /folder1/file.doc. Quote Link to comment Share on other sites More sharing options...
Miss_Rebelx Posted September 16, 2010 Share Posted September 16, 2010 It all depends... is it a local file? If you can reach it within your domain, you can use a relative path (/folder/file.ext). Otherwise, if it's somewhere else for example on a different server, then use an absolute path (http://www....). More info can be found via google. Quote Link to comment Share on other sites More sharing options...
chintansshah Posted September 17, 2010 Share Posted September 17, 2010 you can use <a > tag but if you are trying to do with .txt file then it's open in browser only not give a popup to download. Please visit below link and code to implement download file. http://php.net/manual/en/function.header.php <?php// We'll be outputting a PDFheader('Content-type: application/pdf');// It will be called downloaded.pdfheader('Content-Disposition: attachment; filename="downloaded.pdf"');// The PDF source is in original.pdfreadfile('original.pdf');?> 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.