Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Change the maximum upload file size

I have a website hosted on a PC I have no admittance to. I have a transfer structure permitting individuals to transfer mp3 records up to 30MB large. My server-side script is done in PHP.
Each time I attempt to upload a record, I get a blunder citing that the document surpasses the most extreme size permitted, so I need to expand the size. My examination on the web recommended evolving the .htaccess php.ini file which I don't approach, so that will not work. Others proposed that I should add a custom php.ini document to my root which didn't work. Some other ideas?
by

2 Answers

akshay1995
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

After modifying php.ini file(s), you need to restart your HTTP server to use new configuration.

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.
sandhya6gczb
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

Login / Signup to Answer the Question.