Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

htaccess file

Hi i i can limit upload file on server by htaccess file. I use centos linux.
0
umaxim
Asked:
umaxim
1 Solution
 
Julian MatzCommented:
Sorry, I'm not sure what your question is. What do you need help with? Could you rephrase the question, please?
0
 
Julian MatzCommented:
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

0
 
nociSoftware EngineerCommented:
Or do you mean block PUT & POST?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
umaximAuthor Commented:
I mean upload limit of file.
0
 
umaximAuthor Commented:
julianmatz: your code will limit size of file to 20 mb
0
 
Julian MatzCommented:
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

0
 
Steve BinkCommented:
>>> 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 http://us.php.net/manual/en/ini.core.php#ini.upload-max-filesize and http://us.php.net/manual/en/ini.core.php#ini.post-max-size.  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 http://httpd.apache.org/docs/current/mod/core.html#limitrequestfieldsize.  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 http://support.microsoft.com/kb/260694/en-us for more information.

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