This question already has answers here:
Kohana - controller specific .htaccess
(2 answers)
Closed 7 years ago.
Basically I'm not allowed to use PHP's ini_set function to increase upload file size for a formular.
Now I'm trying to change it via htaccess, which works but seems to have the effect that its increased in every controller/form/view.
How am I able to increase the post_max_size in only one special controller/form/view?
When I put the htaccess in the public folder where the index.php from ZEND is, it works, but then it works in every form/controller.
I was trying it with (food is my controller), but this wont work:
<FilesMatch "^(food)">
php_value post_max_size 200MB
</FilesMatch>
Instead of doing that in your main .htaccess file. Put the php vars in an .htaccess file in the same folder as the upload script.
php_value post_max_size 200M
php_value upload_max_filesize 200M
Note: You might need to include the max filesize too because both are needed to increase upload limit.
Related
I have a upload script which allows uploads up to 2 GB. My apache2 server allowed only 8MB of post_max_size. Is there any solution to define such properties from the php.ini in the htaccess. The reason why i want it to get it worked like that? I just want to use such big post_max_size only for my application not for the whole apache2 server.
Any ideas?
You can set the upload_max_filesize property to whatever value you want within either php.ini, .htaccess, or even httpd.conf. If you are using PHP 5.3 above, you can also set this property in user.ini
you can try this in htaccess files:
php_value upload_max_filesize 100M
php_value post_max_size 100M
or you can create php.ini file in root folder of your project put these two lines
upload_max_filesize=100M
post_max_size=100M
I have a page which allows users to upload images.
It is returning a 500 error when the user tries to upload larger images though.
The following code...
<?php echo ini_get("upload_max_filesize");
echo ini_get("post_max_size");
echo ini_get("max_input_time");
echo ini_get("max_execution_time");
?>
...returns:
100M
100M
60
3600
I'm guessing from this that it's the max-input-time that's causing the problem as i've tested with files under 100mb but taking longer than 60 seconds to upload.
I don't have access with my host to the php.ini file, so can I override these settings? I've tried adding an htaccess file but I'm not sure I've put it in the correct place.
Put a .htaccess file in the root folder of your website (where your php script is) and add the following values:
php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 200
php_value max_input_time 200
Of course, you can put other size and time limits. That should work.
Setting up php ini directives depends on the nature of your service provider's configuration. Run a phpinfo() script to look at your configuration. If your provider is starting PHP using suPHP in a user UID context then it may look for a php.ini in the script's directory. This is how it works for my hosting provider.
I'm curently using PHP for uploading images to my server. But -obviously- there's a limit in filesize, and I can't modify the .htaccess file, and can't access the php.ini file..
What happens when I, for example, add:
php_value post_max_size 10100000
, and:
php_value upload_max_filesize 10000000
to the .htaccess file, I get error 500.. This error will stay until I put back the original .htaccess file..
Neither does making a new php.ini in my main folder, or using ini_set() in php help, so my question is: is there a way to upload bigger files without having to alter php.ini or .htaccess ?
thanks in advance,
Jeroen
If you cannot change those directives, there is not much you can do.
Maybe you could use some other language than PHP, for your upload components ?
Maybe a CGI written in Perl, for example -- there are still hosting services supporting those ; and they might not have the same limitations.
this is out of 32bit Linuy limit.
Try using
php_value upload_max_filesize 1500M
php_value post_max_size 1500M
Ok, I think I figured out what to do. I cannot use CGI or PERL on my host, so I got to stick to PHP, and thus I'm left with this memory_limit.. I don't know if ini_set() is enabled on my server, so I need to find a way not to overload the memory dedicated to each request..
What I'm planning to do, is giving every upload (and resize) request a new, fresh page.. So each upload will have it's own iframe!!
This worked in Chrome so far, will test it later for other browsers, as I don't know if post requests will be accepted for iframes in every browser..
I know there are a lot of questions on here about this, but most of them seem to be from people who don't know that 'memory_limit', 'post_max_size', and 'upload_max_filesize' are PHP_INI_PERDIR (i.e. they can't be changed using ini_set()). I already learned that the hard way.
However, everything indicates that I should be able to change them using a .htaccess file—everything, that is, except my actual experience.
Here are the contents of my .htaccess file:
# Allow large file uploads
php_value memory_limit 4294967296
php_value post_max_size 1073741824
php_value upload_max_filesize 524288000
I've tried a number of different combinations, but none of them seem to have any effect on anything. I know I've gotta be missing something, but I can't for the life of me figure out what that something is.
P.S. I'm running PHP 5.2.4 locally on Mac OS X 10.4 from entropy.ch.
You need to permit those settings to be changed in a .htaccess file. For that, you need AllowOverride Options or AllowOverride All in a relevant section your httpd.conf file (in a <Directory> block for that directory or a parent thereof).
Note also this will only work if you're using Apache and mod_php5 (i.e., no CGI/FastCGI/whatever).
See also the manual.
I am attaching a file in a node in drupal using File Attachment. But it is not allowing me to upload a file greater than 1MB. I want to upload a file of 50MB. How to increase this size. Thanks in advance.
Add the below to the relevant php.ini file (recommended, if you have access). Note that for some hosts this is a system-wide setting. However, for hosts running PHP as a CGI script with suexec (for example) you may be able to put these directives in a php.ini file in your Drupal root directory.
upload_max_filesize = 50M
post_max_size = 50M
Add the below to your .htaccess file in your Drupal root directory.
php_value upload_max_filesize 50M
php_value post_max_size 50M
Apart the limit set by PHP, there is also a limit set by Drupal, which is per role. Once you changed the limit set by PHP, you should also change the limit set by Drupal, to get the desired effect.
"Administer » Site configuration » File uploads" ( /admin/settings/uploads ).
You can set Drupal limit per each role. The Drupal settings cannot be larger than those permitted by PHP, but may be smaller if you haven't updated them, so remember to check there also, after updating the php.ini.