Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
413 views
in Technique[技术] by (71.8m points)

php - 更改最大上传文件大小(Change the maximum upload file size)

I have a website hosted on a PC I have no access to.

(我有一个无法访问的PC上托管的网站。)

I have an upload form allowing people to upload mp3 files up to 30MB big.

(我有一个上传表单,允许人们上传最大30MB的mp3文件。)

My server side script is done in PHP.

(我的服务器端脚本是用PHP完成的。)

Every time I try and upload a file, I receive an error claiming that the file exceeds the maximum size allowed, so I need to increase the size.

(每次尝试上传文件时,都会收到一条错误消息,声称文件超出了允许的最大大小,因此我需要增加大小。)

My research on the web suggested changing the .htaccess file which I do not have access to, so that won't work.

(我在网络上的研究建议更改我无法访问的.htaccess文件,这样将无法正常工作。)

Others suggested that I should add a custom php.ini file to my root which did not work.

(其他人建议我将自定义php.ini文件添加到我的根目录,该文件不起作用。)

Any other suggestions?

(还有其他建议吗?)

  ask by Yo Momma translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to set the value of upload_max_filesize and post_max_size in your php.ini :

(您需要在php.ini中设置upload_max_filesizepost_max_size的值:)

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M

After modifying php.ini file(s), you need to restart your HTTP server to use new configuration.

(修改php.ini文件后,您需要重新启动HTTP服务器以使用新配置。)

If you can't change your php.ini, you're out of luck.

(如果您无法更改php.ini,那么您就不走运了。)

You cannot change these values at run-time;

(您不能在运行时更改这些值。)

uploads of file larger than the value specified in php.ini will have failed by the time execution reaches your call to ini_set .

(当执行到达您对ini_set的调用时,文件上传大于php.ini中指定的值将失败。)

See the Description of core php.ini directives .

(请参阅php.ini核心指令说明 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...