Configuring File Uploads

Some of the configuration for the Upload module has already been covered in Chapter 2, in the section on general settings. In particular, the Upload module requires values for the File

System Path setting on the general settings page (admin/settings). You can also specify a temporary directory where files will be saved first while Drupal is processing your upload.

The maximum size of the files that you will be able to upload is controlled by the PHP settings post_max_size and upload_max_filesize. You can adjust these values by explicitly setting them in your settings.php file, assuming your web server allows for this. Find the section of that file titled PHP Settings and add the following lines, adjusting the file size to suit your needs:

ini_set('post_max_size', '5M'); ini_set('upload_max_filesize', '5M');

Unfortunately, in some hosting environments, you are not allowed to override these settings. In such a case, the only recourse is to ask your host to change, or find another host. See and en/ini.core.php#ini.upload-max-filesize for more information about these settings.

You can choose which content types can take attachments on the content type settings page (admin/settings/content-types). For each enabled node type, you can set the Attachments field to enabled or disabled.

The Upload module defines two permissions: Upload Files and View Uploaded Files. Every user role that is granted the Upload Files permission can also be individually configured by selecting administer> settings> uploads (admin/settings/upload). On this page, you can set the Permitted File Extensions, Maximum File Size Per Upload, and Total File Size Per User values. This gives you total control over what kind of files are uploaded to your system and how much space they should be allowed take.

Was this article helpful?

0 0

Post a comment