Last updated 29 October 2015. Created on 9 May 2005.
Edited by ashish_nirmohi, dhwani.addweb, tsbah, GoddamnNoise. Log in to edit this page.

The upload core functionality allows users to upload files to the site. The ability to upload files to a site is important for members of a community who want to share work. It is also useful to administrators who want to keep uploaded files connected to a node or page.

Users with the upload files permission can upload attachments. You can choose which post types can take attachments on the content types settings page. Each user role can be customized for the file size of uploads, and the dimension of image files. Note: you must first give a user role upload permissions before you can customize some of these settings.

You can

  1. enable/disable uploads for individual content types at Administer >> Content management >> Content types.
  2. administer storage location of uploaded files at Administer >> Site configuration >> File system
  3. configure file size, file extensions, and other user role defaults at Administer >> Site configuration >> File uploads.
  4. control who can upload and view attached files at Administer >> User management >> Permissions.

The maximum upload size is controlled by your PHP environment. The standard PHP default is 2 MB. If you need to alter this, see the handbook page on how to Increase upload size in your php.ini.

Modifying Private Files

NOTE: If you have private download method enabled:
Administer > Site Configuration > File System > Download Method: Private

Do NOT modify uploaded files outside of Drupal. When you upload a file as an attachment to content, Drupal stores the file size in the database and it is used to generate the header information when it is downloaded. The ONLY way you should modify a file is to delete the attachment and upload the new file.

Files and Revisions

The upload module does not handle file revisions in the sense of the Microsoft Word "track changes" feature. However, if you attach a new version of a file with the same file name to a node, Drupal will automatically modify the filename to avoid conflicts on the filesystem. You then have the option of un-checking the "List" checkbox for the previously attached file.

For more information, check the File Management category of contributed modules.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

belong@mywebworkshop.com’s picture

In order for Drupal to upload you need the permissions to be set to be writable on the server directories. You need Drupal to access the tmp file. Some shared server setups have that already configured, others require a modification to the php.ini file in order for Drupal to know where the tmp file is.

Here's the php.ini code that worked for me:

file_uploads = On
upload_tmp_dir = /home/username/tmp

Check out these issue here for more: http://drupal.org/node/#509230 and http://drupal.org/node/#511394

Another problem that has arisen preventing upload working is having the allowed upload size set in the php.ini as 2MB, when the php.ini file can only understand 2M (meaning 2 MB).

brighter’s picture

i downloaded the private upload module to help me embed the upload feature in my site for my users but i can't use it ; i don't see any readme on how to install the module although i have enabled the module.
Can you help or recommend a new module that will serve the same purpose or better?

warobushek’s picture

I couldn't upload, because my theme contained my version of jQuery.js.
So, you should use your jQuery.js or misc/jQuery.js. Not both.

webservant316’s picture

The files still remain on the server, but I can no longer access the file from the browser.
Is this expected behavior?

Anyone who gives another a cold cup of water certainly will not lose his reward!

lordrt21’s picture

how to show progress (percentage uploaded) in the core upload module?

El Bandito’s picture

hidden under Workflow settings on the main Edit page for the content type.

Hope this helps someone.

El B

Ray Bowler’s picture

I am new to Drupal and am having a couple of problems. The text says to enable/disable uploads in Content types but there is no such type in my content types and I have no idea how to create a new type. I downloaded two modules onto my computer and need to upload them to the server site plus I need to get another module and use it.

Ray Bowler’s picture

I may have posted incorrectly earlier so this may be a duplicate.

I am new to Drupal and am having a couple of problems. The text says to enable/disable uploads in Content types but there is no such type in my content types and I have no idea how to create a new type. I downloaded two modules onto my computer and need to upload them to the server site plus I need to get another module and use it.

Ashford’s picture

Ray, it has been a few months since you posted, but I know when it is me, I like getting an answer.

The uploading they are discussing in the thread is more like an email attachment. The Upload.module lets you upload a file -.pdf, .doc, .txt- and then it is listed as a link at the bottom of your content page. That is why you must enable or disable it on your content_type.

To upload your modules to your server, you will need to find a type of software that is not part of Drupal. You can search for an FTP program. It works very much like moving the files on your home computer and is easy to use. Your web host may have one installed at your hosting Control Panel. I use one called FireFTP that is a free plugin on the FireFox browser. Or, you can use an SSH/Telnet program, like Putty, that uses the computer code command lines. It uploads and unzips folder very quickly.

MFH’s picture

It seems to me that there is not any "upload" nor "file" module in Drupal 6.20 and 6.22.
It also seems that the simple "upload" module exists not beyond version 4.4.
Can anyone confirm this ? It seems that I am obliged to use CCK + FileField, which makes things quie complicated (and, of course, much slower, with the overhead of loading many more modules on each page display). Is there any simpler solution?

lordrt21’s picture

I am using 6.22, and the Upload module is definitely there. Did you forget to activate it in the Modules page, or else check if the core files were transferred properly to the host server.

Ashford’s picture

Go to the Modules page and look under the Core -Optional section. They are alphabetized and it is down towards the bottom of that section. Check mark the box to enable it.

bruc’s picture

I have a small Drupal site where some of the users occasionally move files by accident because of a problem they are having with Internet Explorer.

Is there any simple way to turn off drag and drop within WebFM? Even better, can it be done on a user by user basis?

Thanks. --Bob

subu.purohit’s picture

I am having a strange problem. when I browse an image and click on attach button then progress bar is coming for few second with please wait... text and then it disappears with no error. File and browser buttons are also disappear. I don't know why it is happening but previously it was working properly and still working in my local system. I have comment upload module enabled and it is working properly.

Does anybody know about this ?

Thanks in advance.

subu.purohit’s picture

Ok I got the solution. Actually problem was notification module and PHP 5.3 version. I have to remove '&' from some functions.

vbottelson’s picture

I am having the same problem. It looks like it's going fine and when I hit the upload button, it just empties the browse field and looks like I never uploaded anything. It's just not working. I've checked all my file paths, my permissions, my module is activated, my php.ini file is referring to the proper tmp locations.

This functionality is working on my production site, but it's my development site (which mirrors the production site) is not functioning.

I see the User who replied below with something about deleting "&"'s out of some functions but I am unclear as to what he means. Did you ever find a solution?

thank you!

subu.purohit’s picture

Hi vbottelson,

Sorry to late reply. I think there is a problem with call by reference variable in php 5.3. First of all you need to find what is error actually (if you have installed better_message then uninstall it and you will see then actual error.)
In my case error was coming from

function notifications_content_form_alter(&$form, &$form_state, $form_id) {

then I removed "&" from $form and $form_state.

In your case you have to find error source.

NB: This is only applicable if you are using PHP 5.3.*

drupalam’s picture

I have a standard custom form, with a file upload box. Uploads work when logged in as admin. But if not logged in as admin, you get the error below.

The selected file XXXXX.jpg could not be uploaded. Only files with the following extensions are allowed: .

I have checked file uploads and ckeditor uploads for the user roles.

STILL NOT WORKING.

wimdh’s picture

I changed the total size of the uploads, but the changes aren't taken.
Is this per role, or do individual users have limits set as well?

Thanks
-
Wim

mhlz79’s picture

Hi

I can add an attachment to a page. However, when viewing the page the attachments are not visible. If I go back to the edit screen, the attachment is there.

The attachments are under the maximum file size and are of the correct file type. Using Drupal 6.20

Any suggestions?

Thanks