Hello, i have change the upload_max_filesize in my php.ini file, but i´d like to know if i have to change something else in drupal.

thanks.

Comments

ronan’s picture

If you are using the Upload module, that should be all you need. Other modules may implement their own limits. To check if your upload_max_filesize setting took, create a file called info.php in your drupal dir with the following code in it:

<?php
phpinfo
();
?>

and view it in a browser.

If it is not working you can try adding

php_value upload_max_filesize              32M

to your htaccess... change 32M to whatever number you like.

Hope this helps

------------------------------------
Gorton Studios - Websites that Work. http://www.gortonstudios.com/
http://www.gortonstudios.com/portfolio/technologies/drupal

------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/

andrewbenkard’s picture

Thanks ronan for the info.php tip. Made troubleshooting easier.

(For the record, everyone, adding php_value upload_max_filesize 32M and php_value post_max_size 64M to the .htaccess in Drupal root was the trick. No php.ini change needed. This is a D6 install.)

Imago’s picture

My experience tells me the opposite. No changes in .htaccess work, while uploading a php.ini in the root changed everything. For instance

post_max_size=32M
upload_max_filesize=32M
max_execution_time=180
max_input_time=120

jscoble’s picture

I agree, if you can modify php.ini, I think that would be the preferred route.

Some additional notes:
The post_max_size should be greater than the upload_max_filesize, otherwise files that are the maximum filesize may fail because the upload_max_filesize + header > post_max_size.

If multiple file uploads on a single post are going to be common you will probably want to make post_max_size equal to a multiple of upload_max_filesize.

Make sure your max_execution_time is long enough to both upload the file and copy the uploaded file from the tmp directory to the destination directory. This setting is in seconds. To figure out how long it needs to be figure out how long it will take to upload the file given the expected upload speed, e.g. 128Kbs, and set the max_execution_time to a value slightly higher than that. Remember a Byte(B) is 8 bits(b).

If your using session management, remember to set the session.gc_maxlifetime is large enough to allow for the session to upload and copy the post_max_size

jbrown’s picture

Have a look at this page: http://www.radinks.com/upload/config.php

--
Jonathan Brown
http://openpackage.biz/

--
Jonathan Brown
http://jonathanpatrick.me/

kenorb’s picture

You can increase it through http://drupal.org/project/drupal_tweaks module, but it's not always allowed by the server.

skapunk’s picture

You are My Herooooo

^________________^

php_value upload_max_filesize 32M <<--- It very Goood

audesign’s picture

Every time I try to add a new piece of code to .htaccess, it comes back as a 500 Internal Sever error.
I am trying to add the line of code:

php_value upload_max_filesize 32M
php_value post_max_size 32M

......

The full .htaccess file looks like

#
# Apache/PHP/Drupal settings:
#

php_value upload_max_filesize 32M
php_value post_max_size 32M

# Protect files and directories from prying eyes.

Order allow,deny

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.

# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# PHP 4, Apache 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# PHP 5, Apache 1 and 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# Requires mod_expires to be enabled.

# Enable expirations.
ExpiresActive On

# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600

# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off

# Various rewrite rules.

RewriteEngine on

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
### BOOST START ###
AddDefaultCharset utf-8

Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"

AddCharset utf-8 .html
AddCharset utf-8 .css
AddCharset utf-8 .js
AddEncoding gzip .gz

ForceType text/html

ForceType text/javascript

ForceType text/css

# Gzip Cookie Test
RewriteRule boost-gzip-cookie-test\.html tempcash/perm/boost-gzip-cookie-test\.html\.gz [L,T=text/html]

# GZIP - Cached css & js files
RewriteCond %{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=2]
RewriteCond %{DOCUMENT_ROOT}/tempcash/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz -s
RewriteRule .* tempcash/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz [L,QSA,T=text/css]
RewriteCond %{DOCUMENT_ROOT}/tempcash/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz -s
RewriteRule .* tempcash/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz [L,QSA,T=text/javascript]

# NORMAL - Cached css & js files
RewriteCond %{DOCUMENT_ROOT}/tempcash/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
RewriteRule .* tempcash/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
RewriteCond %{DOCUMENT_ROOT}/tempcash/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
RewriteRule .* tempcash/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

# Caching for anonymous users
# Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
RewriteCond %{REQUEST_URI} (^/(admin|tempcash|misc|modules|sites|system|openid|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
RewriteCond %{HTTP:Pragma} no-cache [OR]
RewriteCond %{HTTP:Cache-Control} no-cache [OR]
RewriteCond %{HTTPS} on
RewriteRule .* - [S=3]

# GZIP
RewriteCond %{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=1]
RewriteCond %{DOCUMENT_ROOT}/tempcash/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
RewriteRule .* tempcash/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html]

# NORMAL
RewriteCond %{DOCUMENT_ROOT}/tempcash/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* tempcash/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

### BOOST END ###
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# $Id: .htaccess,v 1.90.2.5 2010/02/02 07:25:22 dries Exp $

audesign’s picture

everyone keeps saying just stick in the code anywhere! but that's just not true... it need to be inside the bracket code of

# PHP 5, Apache 1 and 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

or whichever php4 etc.

s4j4n’s picture

From the php docs these few pages I found particularly helpful. I was hoping I could set upload_max_filesize in settings.php but no such luck.

Here's why:
http://www.php.net/manual/en/ini.list.php

And read this to understand the "configuration options" which are key:
http://www.php.net/manual/en/configuration.changes.modes.php