The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form

The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form

After installing the owncloud in Ubuntu Server I faced the problem, I was not able to upload the file. I was getting this error “The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form”

owncloud4

How I solved the issue,Below are the steps

Step 1: Edit the php.ini file and increase the value of parameter upload_max_filesize

vi /etc/php5/apache2/php.ini

upload_max_filesize = 10G

Restart the apache after saving the php.ini file

/etc/init.d/apache2 restart

Step 2: The main problem I found in .htaccess file. .htaccess has symlink in /usr/share/owncloud . The original path of htaccess file is at /etc/owncloud/htaccess.
You can choose any path to edit this file

change the value of these two parameters.

php_value upload_max_filesize
php_value post_max_size

sharad@ubuntu-pc:~$ sudo su –
Give the password of user

root@ubuntu-pc:/# cd /usr/share/owncloud
root@ubuntu-pc:/usr/share/owncloud# vi .htaccess
ErrorDocument 403 /owncloud/core/templates/403.php
ErrorDocument 404 /owncloud/core/templates/404.php

php_value upload_max_filesize 2000M
php_value post_max_size 2000M
php_value memory_limit 512M

SetEnv htaccessWorking true

RewriteEngine on
RewriteRule .* – [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^.well-known/host-meta /public.php?service=host-meta [QSA,L]
RewriteRule ^.well-known/carddav /remote.php/carddav/ [R]
RewriteRule ^.well-known/caldav /remote.php/caldav/ [R]
RewriteRule ^apps/([^/]*)/(.*.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]

Options -Indexes

Save and exit by pressing the key “esc :wq”
root@ubuntu-pc:/usr/share/owncloud#

Step 3: Restart the apache2

root@ubuntu-pc:/usr/share/owncloud#/etc/init.d/apache2 restart

Now try again. It should be solved now.

2 thoughts on “The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form”

  1. First of all, thank you for your HowTo.

    If you use an embedded device which stores its /tmp folder in a ramdisk the maximum uploadsize for one file is the size of the ramdisk. If you want larger file you have to enable “upload_tmp_dir” in the php.ini and provide it with a path to a folder on a larger disk. This will php force to store all http uploads on the given location.
    To avoid problems I set the path to the same disk where my owncloud data folder is located.

    Chris

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.