| | #1 |
| Warrior Member Join Date: 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
I have images in my site, I want to download images when someone go to its link by clicking download link instead of viewing them using firefox, can any one help me to do that?
|
| |
| | #2 |
| Warrior Member Join Date: 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
Any one please :-(
|
| | |
| |
| | #3 |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 236
Thanked 1,377 Times in 676 Posts
|
Bumping your own thread after just 12 minutes? Great way to introduce yourself! :rolleyes:
|
| | |
| |
| | #4 |
| Warrior Member Join Date: 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
First, setup your file field so that it saves into a separate directory. This will make it so that you will only force certain files to download and not affect the rest of the files on your Drupal site. Visit Administer -> Content management -> Content types (admin/content/types). Click "Manage fields" on the type that you want files to be forced to be downloaded. Add or edit a file field, under the "Path settings" fieldset, set a path for your files to be uploaded. Now files uploaded to that field will be saved in a separate folder under your sites files directory. FTP to your site and create a file named .htaccess in your files directory. Usually this will be sites/default/files/[name of the subdirectory from step 1]. In that file put the following lines: <FilesMatch "\.(?i:doc|odf|pdf|rtf|txt)$"> Header set Content-Disposition attachment </FilesMatch> This particular example will force files with doc, odf, pdf, rtf, or txt to download instead of being shown in the browser. Upload a few files and (using the "Generic files" display setting), the files will be downloaded when the user clicks on the link. You may need to load mod_headers in Apache2 for this to work. Assuming you have root access it can be done as follows: # a2enmod headers # /etc/init.d/apache2 reload |
| |
|
| Bookmarks |
| Tags |
| code, download, images, view |
| |