Voting starts in March for the Drupal Association Board election.
File Force module can be used to force the user's web browser to download the file to disk instead of displaying it in the browser window.
Web browsers today are pre-configured to render various types of media directly, such as text files, various image, video and audio formats, PDF documents, and Flash movies. While it is still possible to save such files afterwards by right-clicking on them and selecting "Save As..", it is sometimes desirable to just offer the file for download in the first place. File Force solves this issue by supplying a file with certain HTTP headers which instruct the web browser to download the file to the user's disk instead of displaying it in a browser window.
While File Force offers an easy solution to the problem of forcing visitors to download requested files, we advise you to also consider using a web server configuration, especially if you have a high-traffic site and your settings should apply across the board to all files of a specific set of types.
Pre-Defined Configuration Options
File Force offers a number of additional formatters to the supported fields, which can be selected either in the "Display Fields" section of your content type or when adding fields to your view.
For more general templates, like the Upload module's attachment list, please consult the admin/settings/file-force page, where you can select the locations where you want File Force type links to be enabled by default. Note that if your theme already overrides a particular function, selecting it there will have no effect! So if you want to add File Force links to an already themed function, just copy the l() call from the implementation of the corresponding theme function in file_force.theme.inc.
The Image module offers to select types of links shown on the node page, which are extended by a File Force type for you. Note that there is currently a small conflict with the Lightbox2 module, which can be easily fixed though by the site administrator. Seefor more details.
If you want to build File Force links manually, you should first find out what download method (cf. admin/settings/file-system) your site is using, and then act according to one of the following options:
- With the "Private" download method enabled on your site, you can simply use the url() & l() functions with an additional item in the options array, e.g. url($image['filepath'], array('query' => array('download' => '1'))).
- With the "Public" download method enabled by default, you will need to make sure that the File Force link is going through Drupal by passing it through file_force_create_url() first, e.g. l('linktext', file_force_create_url($image['filepath']), array('query' => array('download' => '1'))).
Questions? Suggestions? Need help?
Please open an issue on File Force's issue queue and we'll get back to you soon. Thanks for trying File Force!