An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (8 MB) that this server supports.
Drupal produces this error for a variety of reasons and there are several related settings you need to fix before you can upload.
You may have to make one or more changes in any and all of the following places depending on your Web site configuration and hosting.
- Administer » Site building » Modules
- Administer » Site configuration » Upload
When you buy a Web site hosting plan, you buy either shared hosting (the cheapest) or a Virtual Private Server (more flexible). Your VPS hosting plan usually includes WHM or equivalent to administer multiple accounts within the VPS with each account handling a different set of Web sites. WHM is built by the people who make cPanel. Cloudmin is a free open source alternative for VPS administration and is developed by the people who built Webmin. Webmin overlaps WHM and cPanel.
Within WHM select Server Configuration » Tweak Settings then the section headed PHP. Increase both PHP Max Post Size for cPanel PHP in Megabytes (default 55M with a maximum value of 2047M) and PHP Max Upload Size for cPanel PHP in Megabytes (default 50M with a maximum value of 2047M) to
100M. These changes affect only what cPanel does and part of cPanel is a file upload you may use to handle some of your big files so we keep cPanel in sync with everything else.
Now select Service Configuration » PHP Configuration Editor, select [Switch to Advanced Mode], and change both of the following settings to
100M. This changes the system wide php.ini file and will fix your upload problems if the values are not overridden by something else down the line.
Save the changes then check your upload limit in your web page. This might be the only change you need.
Note that this will increase the limit for every Web site within your VPS. You may hten want to implement smaller limits for some Web sites using one of the following methods.
Your hosting plan usually includes cPanel (it might be optional) or equivalent to administer an account within a VPS or your Web site in shared hosting. Virtualmin is a free open source alternative for Web site administration and is developed by the people who built Webmin.
By default cPanel displays some of the PHP configuration settings but does not let you change them. Look in cPanel to see the upload limit set by your Web hosting service if you do not have a VPS and WHM.
WHM changes your php.ini file for you. If you do not have WHM or equivalent, you have to edit php.ini yourself. Arrgh!!! You could ask your Web site host to change it and a good hosting service will make a small increase. Some hosting companies will not let you touch it and you are stuck with whatever they put there. The problem is that the change will increase the limit for every Web site running under that Web server including a lot of sites you do not own.
if you cannot change php.ini, you might be able to change .htaccess. When you can change php.ini you might still want to use .htaccess or some other technique to limit the upload size for some Web sites.
There might be a
.htaccess file in your web site directory. Drupal installs one by default. The file overrides Apache settings and can include overrides for PHP if your hosting service allows PHP overrides in .htaccess. The hosting service can also allow PHP overrides but ban or limit specific PHP settings. You can add a line to the .htaccess file to increase an upload size if the hosting company allows that change.
The file is only a text file and can be edited in almost any text editor. If you make a minor mistake, Apache should ignore the line with the unrecognised setting. Almost everything else will make Apache do something strange and will often result in an empty Web page. You have to search through logs to find the error.
Some operating systems give special treatment to files starting with a
. and the .htaccess file becomes a
hidden file. You might have to turn on an option to see the file in whatever application you use to access your files. I use Filezilla for FTP access and Filezilla displays hidden files by default.
.htaccess has the disadvantage of being read every time Apache processes a page request, which is an overhead you can avoid. If you have good control of your Web server, moving everything out of .htaccess into php.ini and the Apache configurations files because those files are read only once when Apache starts up. You can then delete .htaccess.
.htaccess has the advantage that Apache looks for .htaccess in every directory from the Web root down to the page you request. When you have several Web sites in different subdirectories, you can have a different .htaccess in each subdirectory. Using the Upload module override in each Web site is easier.
Administer » Site building » Modules
Switch on the
Upload module in Administer » Site building » Modules then configure uplad limits for your Web site in the Drupal administration pages.
This information is based on the Upload supplied in Drupal version 6.16. The module description says
Allows users to upload and attach files to content. The module is not listed as a prerequisite for other upload options and you do not need it for uploads but it does give you the following page to change some of the default PHP related settings in Drupal. Using this option keeps you in the Drupal administration pages and away from .htaccess.
Administer » Site configuration » File uploads
Maximum resolution for uploaded images:
The maximum allowed image size (e.g. 640x480). Set to 0 for no restriction. If an image toolkit is installed, files exceeding this value will be scaled down to fit.
List files by default:
Display attached files when viewing a post.
Default permitted file extensions:
[jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp]
Default extensions that users can upload. Separate extensions with a space and do not include the leading dot.<.em>
Default maximum file size per upload:
The default maximum file size a user can upload. If an image is uploaded and a maximum resolution is set, the size will be checked after the file has been resized.
Default total file size per user:
The default maximum size of all files a user can have on the site.
Your PHP settings limit the maximum file size per upload to 8 MB.
That last bit,
8 MB, should change to
100 MB after you change things in WHM. If it does not change then you have to look elsewhere.
Drupal has a settings.php file that can override the other upload settings if your hosting service allows overrides of those PHP settings from within an application. You should have nothing about upload sizes in your settings.php file because you should never have to edit the file. Use the Upload module to make the changes.
Changes to settings.php will be lost when you make a major upgrade to Drupal because you will start with a new default_settings.php file. Changes made by the Upload module should be carried across to the new version of Drupal in the database. Changes made in the database will also appear in your database backups, another good reason to make the changes using the Upload module instead of editing the settings.php file