Solved

Increase max_upload_size on the server!.

Posted on 2004-08-09
20
5,679 Views
Last Modified: 2008-03-03
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
Comment
Question by:str_kani
20 Comments
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752646
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
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752652
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
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752660
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
 
LVL 12

Author Comment

by:str_kani
ID: 11752661
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
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752667
thats ok, none of the above solutions require you do to so.
0
 
LVL 12

Author Comment

by:str_kani
ID: 11752690
Please tell me whether it can be done or not?
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752707
yes... using one of the above solutions
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752715
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
 
LVL 12

Author Comment

by:str_kani
ID: 11752728
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
 
LVL 27

Accepted Solution

by:
Diablo84 earned 50 total points
ID: 11752744
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 12

Author Comment

by:str_kani
ID: 11752780
I see that eactly you said... Actually what are they master and local. Could you Please explain that in a few line.
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752785
to the left of it rather
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752795
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
 
LVL 12

Author Comment

by:str_kani
ID: 11752892
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
 
LVL 27

Expert Comment

by:Diablo84
ID: 11752944
Thats a whole new question and could be any number of things

error in code, error with folder permission etc
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11753022
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
 
LVL 9

Expert Comment

by:waygood
ID: 11753290
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
 
LVL 12

Author Comment

by:str_kani
ID: 11753637
I am getting this warning.....

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

How to solve this.?
0
 
LVL 18

Expert Comment

by:arantius
ID: 11754639
You can't.  That's a setting your web host controls.
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11756195
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now