0

do we have any size issue with the file uploads that we perform in php using $_file[upload][name]? is there any restriction for the file upload using this ??? juz need to know ..

2
  • is there any upper limit for the upload size? Commented Jul 28, 2010 at 14:51
  • are you using your own hosting? or provided hosting? because if you do not host yourself, chances are there is no php.ini on your ftp. If this is the case I can help you further, then comment Commented Jul 28, 2010 at 14:54

4 Answers 4

8

In your php.ini

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M

and (added after suggestions from others below)

; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
post_max_size = 8M
Sign up to request clarification or add additional context in comments.

3 Comments

Don't forget post_max_size as well. It doesn't matter that upload_max_filesize=2G if post_max_size=16k
@Mark, your remark is incorrect, altough uploaded files are part of post data. PHP will allow, and handle correctly, upload_max_filesize=1G with post_max_size=2M. You'll get 1G files through, but otherwise post data is limited to 2m.
There's also server-side limits, such as Apache's LimitRequestBody on top of all this.
2

You can limit maximum file uploaded size (you should change appropriate directives in your php.ini file). There are no other ways to limit uploaded file size.

upload_max_filesize = 1M //Maximum size of uploaded file
max_post_size = 1M //Maximum size of whole POST request

1 Comment

Actually the quota of disk space avaialable is also a limit ;)
2

You can also change limits in .htaccess file:

php_value upload_max_filesize 10M
php_value post_max_size 20M

Comments

1

Yes, this is restricted specifically by upload_max_filesize and also more generally by post_max_size settings in your php.ini.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.