View Full Version : Dowload Function
10-03-2011, 01:49 AM
Is there a way to make a function that downloads a file to a computer? The file would just be text.
10-03-2011, 08:41 AM
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
10-03-2011, 03:47 PM
The simplest way to emulate an HTML download tag is to simply tell people to right-click on the link to download the file. When you right click a link one of the options on the context menu is a "Save As..." or "Save link as...". When you choose that, the file on the other side of the link is downloaded to the hard drive, even if it can be opened in the browser.
A simple download message:
Right click the link below and choose "Save As..." to download this file.
10-03-2011, 04:38 PM
This must be solved on the server side. In order for the browser to prompt the user to save the file to disk, the proper headers will need to be set. The following is an example using PHP to force a .txt file to be saved to disk.
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=text.txt");
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.