04May2011
Author
Dave
Category
htaccess
Tags
, ,
Override file upload sizes an htaccess file Thumbnail

Override file upload sizes an htaccess file

A tutorial to override file upload sizes an htaccess file. Note htaccess files only work on a linux server by default you can only upload files up to 2MB in file size but this can be increased with an htaccess file

A tutorial to override file upload sizes an htaccess file. Note htaccess files only work on a linux server

By default you can only upload files up to 2MB in file size but this can be increased with an htaccess file.

To create an htaccess file open notepad or any plain text editor and save the file as .htaccess, if using notepad make sure the file type is set to all files or you will create a txt file.

start with php_value which tells the server to expect a rule to follow

To increase the file size that can be uploaded use the rule upload_max_filesize followed by the file size in mega bite (MB)

#set max upload file size
php_value upload_max_filesize 20M

You may also need to increase the max size that a form can send this is done using the rule post_max_size followed by the file size in mega bite (MB)

#set max post size
php_value post_max_size 20M

When uploading big files the server can time-out as there is a time limit for the data to be sent, This again can be increased using this rule max_execution_time followed by the time in seconds

#set max time script can take
php_value max_execution_time 200

You can increase the input time for the server using the rule max_input_time followed by the time in seconds

#set max time for input to be received
php_value max_input_time 200

The final file will look like this:

#set max upload file size
php_value upload_max_filesize 20M
#set max post size
php_value post_max_size 20M
#set max time script can take
php_value max_execution_time 200
#set max time for input to be recieved
php_value max_input_time 200

Save the htaccess file in the root of the server or in the directory where you want to override file upload sizes.

Author
Dave

About the Author

has written 72 articles on Dave is my name.

My name is David Carr I'm a PHP web developer based in Hull it is my passion to design and develop clean, accessible and usable websites using PHP and other web technologies, I'm an avid Twitter user why not follow me? https://twitter.com/daveismynamecom

Visit this author's website   ·   View more posts by

Sharing is caring.
  • Subscribe to our feed
  • Share this post on Delicious
  • StumbleUpon this post
  • Share this post on Digg
  • Tweet about this post
  • Share this post on Mixx
  • Share this post on Technorati
  • Share this post on Facebook
  • Share this post on NewsVine
  • Share this post on Reddit
  • Share this post on Google
  • Share this post on LinkedIn

Discussion

No responses to "Override file upload sizes an htaccess file"

There are no comments yet, add one below.

Leave a Comment