• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5692
  • Last Modified:

Increase max_upload_size on the server!.

Is threre any way to increase the default file size of 2MB to 20 MB, my web server admin won't allow changes in the php.ini on the server. Is threre any way I can allow my users upload around 20 MB.
-kani
0
str_kani
Asked:
str_kani
1 Solution
 
Diablo84Commented:
Thank you :)

1) create file named ".htaccess" in root folder (unless one already exists)
2) add the following line

php_value upload_max_filesize "20M"
0
 
Diablo84Commented:
that will change the local value (which will be applied to all scripts in your site) but wont affect the master value in the servers php.ini
0
 
Diablo84Commented:
you could probably instead (if you only want to apply the setting to one script) add this line to the top of your script

ini_set("upload_max_filesize", "20M");
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
str_kaniAuthor Commented:
My aim is to allow my site users to upload upto 20 MB files. My web master says he won't change settings in the php.ini on the server.

0
 
Diablo84Commented:
thats ok, none of the above solutions require you do to so.
0
 
str_kaniAuthor Commented:
Please tell me whether it can be done or not?
0
 
Diablo84Commented:
yes... using one of the above solutions
0
 
Diablo84Commented:
To recap:

option a)

create a .htaccess file in the root folder and add the line

php_value upload_max_filesize "20M"

or

option b)

add the following line to the top of your script

ini_set("upload_max_filesize", "20M");
0
 
str_kaniAuthor Commented:
I created a file swe.htaccess
added this
php_value upload_max_filesize "20M"

placed this file in the root folder i.e. www.site.com

created another file...
<?php
echo phpinfo();
?>
still it shows 2M for the max file upload
0
 
Diablo84Commented:
should be

.htaccess

no prefix

>> still it shows 2M for the max file upload

the master value will display as 2M and the local value (to the right of it) should display as 20M
0
 
str_kaniAuthor Commented:
I see that eactly you said... Actually what are they master and local. Could you Please explain that in a few line.
0
 
Diablo84Commented:
to the left of it rather
0
 
Diablo84Commented:
master values are those set in the php.ini basically

local values are those changed using a .htaccess file or the ini_set function which only apply to one user and do not affect master settings
0
 
str_kaniAuthor Commented:
I tried to upload a zip of 3.9 MB the browser silently executed, but the file is not there in the position it should be. i.e the code is executed but the file hasn't uploeaded !
0
 
Diablo84Commented:
Thats a whole new question and could be any number of things

error in code, error with folder permission etc
0
 
Diablo84Commented:
check for obvious errors in your code and check you are using the correct syntax

and make sure you check that the folder you are uploading to has the permission set as 666 (or 777 for full access)
0
 
waygoodCommented:
I know this doesnt affect what your having trouble with at the moment.
But there is also a timeout in php and apache, it may be a good idea to increase these aswell.
0
 
str_kaniAuthor Commented:
I am getting this warning.....

Warning: set_time_limit(): Cannot set time limit in safe mode in

How to solve this.?
0
 
arantiusCommented:
You can't.  That's a setting your web host controls.
0
 
Diablo84Commented:
for general local settings using ini_set please refer to the manual online @ http://www.php.net/manual/en/function.ini-set.php
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now