Free content is a fantastic way of building customer loyalty. Depending on the content that you provide, you can also keep your brand in front of people. For example, a simple tastefully-done screen saver or desktop background can be used to always keep your logo on your customers’ desktop. Of course, you need to make sure that the free content is of the highest possible quality to ensure that the customers will actually use the content.
Many visitors want to print content or save it to their computers for later use when they are not online or are not working on their computers. We will build PDF files automatically, to give your visitors this convenience.
If you allow visitors to download content from your site, you need to be careful that your site security is solid, so that an unscrupulous user cannot download content that you don’t want them to have access to. We will discuss how to protect your content in this article.
In this section, we will discuss how to add downloads and PDFs to the web site.
Good Eatin’ Goal: Ensure that Drupal has full control over any files that are uploaded, so that we can specify who can download the files.
Additional modules needed: None
Drupal allows you to set downloads to either Public or Private. The public setting does not have any additional download security. The private setting allows Drupal to secure and manage the downloaded files.
You can control this functionality using the File system settings, which are available by selecting Site configuration and then File system, from the Administer menu, as shown in the following screenshot:
Because we want Drupal to provide additional security for the downloaded files, we will select the Private setting and then save the configuration.
You can also control where the files are stored on the web site, and also specify a temporary location to be used while files are being transferred. In most cases, the defaults are acceptable. However, you may need to customize the directories depending on how your server and site are configured. If you are using the private download method, the File system path should not be accessible via a web browser. To ensure that a directory is not available via a web browser, you should choose a folder that is not located within the Drupal installation. It should also not be located within your root web folder. On most systems, the root web folder is named htdocs. If you are unsure what your root web folder is, ask your webhost. Some hosting companies do not allow you to create folders outside the root web folder. If this is the case, you can contact your host to see if they can make an exception, or you will have to use the public download method.
Good Eatin’ Goal: Allow authorized users to upload a file to the web site.
Additional modules needed: Upload (core).
In order to allow a user to download a file, you must first upload files to the web site. We will create a downloads page that stores all of the files that have been uploaded.
{literal}
We can now customize the permissions for the Upload module by clicking on User management and then on Permission. The available permissions are shown in the following screenshot:
It is a good idea to give only authenticated users the ability to view and download files. This will provide an additional incentive for visitors to register on your web site.
Good Eatin’ Goal: Ensure that the correct file type is sent to the browser so that the visitor’s computer can accurately determine how to handle it.
Additional modules needed: File MIME (http://drupal.org/project/filemime).
As you add files to your site for download, it is important to make sure that a visitor’s browser knows how to display the file. With web sites, this is done by setting the MIME type for the file. Some common MIME types are:
A full list of how Drupal handles each file type can be found at: http://api.drupal.org/api/function/file_get_mimetype.
The File MIME module automatically detects the type of file based on the file extension, and sets the appropriate MIME type, which is returned to the browser.
To use the File MIME module, carry out the following steps:
application/vnd.ms-excel csv xls.
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…