简体   繁体   English

解决错误413请求实体太大

[英]Work around Error 413 request entity too large

I'm working in project that allow to our employee to upload large files to our shared host and getting download link. 我在项目中工作,允许我们的员工将大文件上传到我们的共享主机并获取下载链接。 the problem is that our hosting refuse to change LimitRequestBody for shared hosting. 问题是我们的主机拒绝为共享主机更改LimitRequestBody。 there is any other solution to work around LimitRequestBody or any other way to do this job? 还有其他解决方案可以解决LimitRequestBody或其他任何方式来完成这项工作吗?

Two ways to get it work, manual chunk upload or by tools. 有两种方法可以使它工作,手动上传或通过工具。

You can use Real Ajax Uploader tool. 您可以使用Real Ajax Uploader工具。 It can used with html5 the upload of the files is done by chunks, with small request to the server for perfomance and robustness. 它可以与html5一起使用,文件的上传由块完成,向服务器提供小的请求以获得性能和健壮性。

Or manually split the files to many chunks then upload them one by one. 或者手动将文件拆分为多个块,然后逐个上传。 you can use 7-zip to split file and combine files. 您可以使用7-zip分割文件并合并文件。 here is an tutorial . 这是一个教程

For client split you also refer to File uploads; 对于客户端拆分,您还可以参考文件上传; How to utilize "chunking"? 如何利用“分块”?

For sever chunk combine you can refer to Handling plupload's chunked uploads on the server-side and http://www.phpclasses.org/package/8858-PHP-Create-and-merge-Zip-archives-split-in-parts.html 对于服务器块组合,您可以参考在服务器端处理plupload的分块上传http://www.phpclasses.org/package/8858-PHP-Create-and-merge-Zip-archives-split-in-parts。 HTML

hope it helps. 希望能帮助到你。

You can override default values of upload_max_filesize and post_max_size . 您可以覆盖upload_max_filesizepost_max_size默认值。 Both of these two ini settings have change mode as PHP_INI_PERDIR which means you can either use one of the following 这两个ini设置都具有更改模式为PHP_INI_PERDIR ,这意味着您可以使用以下之一

php.ini, .htaccess, httpd.conf, .user.ini php.ini,.htaccess,httpd.conf,.user.ini

Since you're using shared hosting so best suitable option is .htaccess or .user.ini 由于您使用的是共享主机,因此最合适的选项是.htaccess.user.ini

You can refer this to set values using htaccess Set php Ini settings using htaccess 您可以使用htaccess将此参考设置为使用htaccess 设置php Ini设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM