tags:

views:

448

answers:

3

So I have a website hosted on a pc I have no access to. I have an upload form allowing people to upload mp3 files up to 30mb big. My server side script is done in php. Problem: everytime I try and upload a file I receive a error claiming the file exceeds the max size allowed. So now I need to increase the size. My research on the web suggested changing the .htaccess file which I do not have access to so thats a bit no no. Others suggested that I add a cutom php.ini file to my root which did not work. Any other suggestions?

+10  A: 

You need to set the value of upload_max_filesize and post_max_size in your php.ini :

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M

If you can't change your php.ini, you're out of luck. You cannot change these values at run-time; uploads of file larger than the value specified in php.ini will have failed by the time execution reaches your call to ini_set.

See http://php.net/manual/en/ini.core.php

meagar
do you perhaps know the default route that the php.ini file is stored?
Yo Momma
On Linux, it's usually in /etc/php/ or something along those lines. If you're on a shared server, you're out of luck unless your hosting provider is generous enough to provide a per-user php.ini file.
Johannes Gorset
If your using WAMP under windows, you can edit it by clicking the WAMP icon > PHP -> php.ini. In Debian, my config file is in /etc/php5/apache2.
meagar
Thats the main issue, my website is on a shared server. So is that the general consensus, that I'm fresh out of luck? :(
Yo Momma
There is no way to bypass this, by design - it's important that the owner of a server be able to explicitly cap upload size for users. The best you can do is appeal to somebody who has access to php.ini to make the changes for you.
meagar
I contacted my service provider and it seems like they might help me out. Thanks for the input everybody.
Yo Momma
+3  A: 

You can change it via an .htaccess file.

.htaccess files are stored in the same directory as your .php files are. They modify configuration for that folder and all sub-folders. You simply use them by creating an .htaccess file in the directory of your choice (or modify it if present).

The following should enable you to increase your upload limit (if the server provider allows PHP config changes via .htaccess).

php_value upload_max_filesize 40M
php_value post_max_size 42M
Andrew Moore
A: 

it does not work for me.. i modified this custom build PHP mvc framework from

SaNNyX