htaccess file

Posted on 2011-03-17
Last Modified: 2012-05-11
Hi i i can limit upload file on server by htaccess file. I use centos linux.
Question by:umaxim
LVL 21

Expert Comment

by:Julian Matz
ID: 35163183
Sorry, I'm not sure what your question is. What do you need help with? Could you rephrase the question, please?
LVL 21

Expert Comment

by:Julian Matz
ID: 35163203
Or do you mean PHP's file upload limit? If so, try putting the following into your .htaccess file:

php_value upload_max_filesize 20M

Open in new window

LVL 40

Expert Comment

ID: 35164792
Or do you mean block PUT & POST?
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.


Author Comment

ID: 35165000
I mean upload limit of file.

Author Comment

ID: 35165007
julianmatz: your code will limit size of file to 20 mb
LVL 21

Accepted Solution

Julian Matz earned 500 total points
ID: 35168476
Yes, that's right. You can change it to whatever size you want - e.g. 100M would be 100 MB.

You might also need to set the following:

php_value post_max_size 20M

Open in new window

LVL 50

Expert Comment

by:Steve Bink
ID: 35170041
>>> julianmatz: your code will limit size of file to 20 mb

...only for PHP.  This is an important point, if you are not using PHP.

The GET method has a limit of around 2k - a rather tight ceiling.  It normally is not used for...well, anything.  I'm a big fan of not using query strings.

The POST method has no limit by specification, but implementation limits must necessarily apply.  For example, older servers using 16-bit variables could only hold 65536 bytes.  With the move to 32-bit (~2.1GB), then 64-bit(~18.5 thousand TB), that limit increased accordingly.  So, the web service's hard limit is going to based on the type of addressing used to hold/point to the data.  

I know certain handlers/filters/modules can also enforce an arbitrary limit.  For example, PHP's post_max_size and upload_max_filesize, as described by julianmatz.  You can find more information on those directives at and  In ColdFusion, I understand there is a default limit of 100MB, and it can be modified through a CF administration panel.  I have seen some articles that indicate this limit can be set by the browser (client) as well, but there is nothing you can do to change that when developing on the server side.  

If you want a language agnostic solution, the web server can be set to an arbitrary limit as well.  Since your question is about Apache, you probably want  I have never used this directive, so I am unsure how it will impact your server's performance or behavior.  With IIS, Microsoft describes a registry key used to set the limit on POST data.  See for more information.


Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Running Guacamole on port 80 5 162
maven set up 2 128
PHP Error Settings 12 78
Issues installing SSL certificate into Apache Tomcat 3 87
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

20 Experts available now in Live!

Get 1:1 Help Now