php 上传文件大小怎么设置?

2024-12-02 07:25:27
推荐回答(2个)
回答1:

php 上传文件大小设置方法是在PHP.ini中设置的。
1、打开php.ini文件,内容如下:

; any text on a line after an unquoted semicolon (;) is ignored
[php] ; section markers (text within square brackets) are also ignored
; Boolean values can be set to either:
; true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes
post_max_size = 100M
; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"
; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"

2、加入upload_max_filesize = 10M就是设定了最大上传文件为10M。
需要注意的是,把post_max_size 大于 upload_max_filesize 的设置为好。
3、设置结束后,需要重新启动apache。

回答2:

首先在php.ini中设置文件上传的大小,
file_uploads = On ;打开文件上传
upload_max_filesize = 100M ;上传上限