tags:

views:

75

answers:

5

I am trying to alter the upload_max_filesize to 4M using .htaccess

php_value upload_max_filesize 4M

But PHP continues to cap the size at 2M

upload_max_filesize 2M 2M 

Any suggestions?

A: 

Investigate chunked uploads - there's a lot of questions about this on SO :)

danp
Not sure how this answers his question, which is about changing a PHP setting?
Pekka
Thanks Pekka...I don;t want to go in different directions :)
Dr. DOT
Seems he's fine, as has root on the server - but shared hosting often won't let you change the upload limits, come what may, so chunked uploads would get round this.
danp
A: 

Instead of using the htaccess try with:

<?php
ini_set("upload_max_filesize", "4M");
?>

I don't know if it works but it can be a workaround

mck89
I'll try... I don;t think it will work because according to the php.ini documentation, this can only be altered via .htaccess or httpdconf
Dr. DOT
No, didn't work
Dr. DOT
A: 

As mck89 suggested, try using ini_set - if you're on a shared host you might need to use that function or place a php.ini file somewhere as not all hosts allow using .htaccess to set PHP configuration.

Ross
tried ini_set() that failed.
Dr. DOT
How can I determine if my host allows me to use .htaccess to alter php.ini configs?
Dr. DOT
Best way is to ask them.
Ross
A: 

Here's the answer

<IfModule mod_php5.c>
    php_value upload_max_filesize 4M
</IfModule>

(a) Need to put the setting in a IfModule container (b) need to put the .htaccess file in the document root

Or at least that's how I got it to work...

Dr. DOT
A: 

You might also want to take a look at your post_max_size setting as it also affects upload size limits.

Archimedix
Thanks Archimedix...it's set at 8M. More than sufficient for my app.
Dr. DOT