【问题标题】:Optimaze php 'upload_max_filesize' and 'post_max_size' setting优化 php 'upload_max_filesize' 和 'post_max_size' 设置
【发布时间】:2013-06-29 12:34:39
【问题描述】:

我在 php.ini 中设置了“upload_max_filesize=1024M”和“post_max_size=1024M”。

我通过网络浏览器上传大文件(2048M)时发现问题。

文件仍在上传,而我可以看到上传进度号,并立即在 apache 服务器日志 (/var/log/apache) 中收到 PHP 消息,如下所示:

"PHP Warning:  POST Content-Length of 2147483647 bytes exceeds the limit of 1073741824 bytes"

最后上传作业失败,因为文件大小大于upload_max_filesize (2048M > 1024M)

在我知道文件大小大于upload_max_filesize 的情况下,如何尽快拒绝上传作业?

【问题讨论】:

标签: php file-upload php-ini


【解决方案1】:

这可以通过 HTML5 完成。

<input type="file" id="myFile" />


var size = document.getElementById("myFile").files[0].size;

【讨论】:

    猜你喜欢
    • 2011-12-06
    • 1970-01-01
    • 1970-01-01
    • 2021-07-24
    • 2010-11-22
    • 2016-03-24
    • 1970-01-01
    • 2015-05-13
    • 2012-10-27
    相关资源
    最近更新 更多