wesupport

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

How to fix Joomla error “There was an error uploading this file to the server”

by | Dec 21, 2016

In Joomla, ‘There was an error uploading this file to the server’ message is often seen by users while trying to upload a template, extension or any file such as backup, via the front-end interface.

For instance, when you try to install an Joomla extension using the feature ‘Extensions >> Extension Manager >> Install >> Install from Directory‘, this error message can cause the installation to fail.

What causes “There was an error uploading this file to the server” error in Joomla

Server owners who run Apache and PHP in their servers have certain restrictions and limits set for various parameters such as upload size and number of connections.

These restrictions on upload size and connection limits, especially in shared servers, are important to ensure that a single user account does not abuse the entire server resources.

A commonly set value for PHP upload size limit is 2 MB. This limit is set using the parameter ‘upload_max_filesize‘ in php.ini, which is the configuration file for PHP in the servers.

When users attempt to upload files above this limit via any PHP script, the file upload fails with the error message “There was an error uploading this file to the server“.

While exceeding the upload size limit is the major reason for this Joomla error, other causes such as wrong setting for the temp directory, incorrect ownership and permissions of folders or open_basedir restriction can also show the file upload error.

How to fix Joomla error “There was an error uploading this file to the server”

To fix this Joomla error during uploads or automatic installations, you need to follow a step-by-step procedure as we will see here:

1. Verify PHP upload size limit

The first aspect to verify is the upload size limit for PHP. To know the PHP settings for a website, create a phpinfo file in the directory with the content:

phpinfo();

This file, when accessed in the browser, would show the PHP limits for the server and the domain. Check the values given for the parametersupload_max_filesize’ and post_max_size’.

The parameter post_max_size' is the maximum size for all upload data. Both these parameters should have values higher than the file you are trying to upload. So if they are lower than required, increase their values.

For cPanel users, the option ‘Software and Services -> PHP configuration’ will display the PHP limits for that website.

 

Joomla "There was an error uploading this file to the server”

Verify PHP upload size limit for the site

 

Another setting to check is Joomla’s maximum upload size that is set in the Media Manager’s settings and ensure that its given a high value.

2. Increase PHP file upload size limit

If the PHP upload size limit is lesser than required, then the next step is to increase this limit. To do this, locate the ‘php.ini’ file location from the phpinfo page and edit the directives ‘upload_max_filesize’ and ‘post_max_size’ to a higher value, say “10M” or more.

The value set for ‘post_max_size’ should be higher than ‘upload_max_filesize’, as it includes all upload limits. These settings are server-wide and require superuser privilege.

There are two ‘php.ini’ files for users when SuPHP is enabled. While the server-wide php.ini can be tweaked to increase the upload size limit in the whole server, the php.ini in individual user accounts help to configure the setting per user.

Instead of changing the server wide limit, some hosts allow users to override the settings using their php.ini or the .htaccess file in their Joomla directory with the content as:

php_value upload_max_filesize 12M

After making the changes, reload the server configuration by restarting the webserver. Now the increased PHP limits will come into effect and you would be able to successfully upload files without error.

joomla there was an error uploading this file to the server

PHP file upload size limit in phpinfo page

3. Correct the folder permissions

In those cases where the upload error happens even after having enough upload size limits set, next option is to check the permissions of directories where the files are to be uploaded.

Joomla has a temporary directory that is created to upload the files before transferring them to the destination directory. This temporary directory should be writable by PHP.

Inorder to make the directory writable, the correct permissions for the folders in the document root for Joomla are:

* 0755 Directory (or 0711 where more security is required)
* 0644 HTML file
* 0600 PHP file (not readable by other users - especially config files).
* 0400 PHP configuration files where the application complains that they are writable.

If the permissions are not adequate, then the upload fails with the error “There was an error uploading this file to the server”. These permissions can be changed using the ‘File Manager’ in cPanel or via backend.

In some servers, this temporary directory for upload has to be set in user’s php.ini file as:

php_value upload_tmp_dir = /my/path/to/my/website's/home/dir/tmp

4. Check for open_basedir restrictions

The ‘open_basedir’ restriction is used to restrict PHP to access files within certain folders only. If a file is outside the path defined by open_basedir, PHP cannot open it.

This is a security restriction that is set in servers to prevent hackers from stealing confidential data from user accounts using malicious scripts.

So, if the file upload gives error ‘There was an error uploading this file to the server’, then you need to verify if any such restriction is in place for that website or Joomla directories.

Another PHP setting to verify is the ‘max_execution_time‘, which is set in seconds, based on the upload speed. You need to ensure that the max execution time set is long enough to upload the file and copy it from the temp directory to the destination directory.

In short..

Today we saw how to fix the Joomla error “There was an error uploading this file to the server” that happens when trying to use automatic installers or uploaders in Joomla.

Increasing the server limits for PHP upload size is not always advisable beyond a certain value, because users can end up abusing the server resources otherwise.

In cases where there are security or access restrictions to the server to edit the PHP limits, it is also possible to do a work around with manual uploads and installations.

Bobcares helps server owners set PHP upload size limits within safe values, but without affecting user functionality. If you’d like to know how to manage your Joomla hosting business efficiently and with zero downtime, we’d be happy to talk to you.

 

 

Get a FREE consultation

Do you spend all day answering technical support queries?

Wish you had more time to focus on your business? Let us help you.

We free up your time by taking care of your customers and servers. Our engineers monitor your servers 24/7, and support your customers over help desk, live chat and phone.

Talk to our technical support specialist today to know how we can keep your service top notch!

TALK TO AN EXPERT NOW!




Bobcares provides Outsourced Hosting Support and Outsourced Server Management for online businesses. Our services include Hosting Support Services, server support, help desk support, live chat support and phone support.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags