省流总结:
通过修改配置文件以开启分片上传的方式,让藏在cloudflare之后的自建nextcloud绕过cloudflare免费版本身100M大小的上传限制。此方法对网页端和官方客户端上传有效,第三方客户端无效。
具体方法:
1.首先,需要确认自己的源站web服务器默认允许上传的最大限制在合适自己的范围内(可以通过检查相应的php.ini来确认)
2.登录到服务器,找到放置nextcloud站点的根目录,进入 apps/files/js 目录,找到 jquery.fileupload.js 这个文件,并使用文本编辑器打开。
3.跳转到第154行附近,找到 maxChunkSize 这个值,将其修改为其他数值即可
// To upload large files in smaller chunks, set the following option // to a preferred maximum chunk size. If set to 0, null or undefined, // or the browser does not support the required Blob API, files will // be uploaded as a whole. maxChunkSize: undefined, //就是这个,这是默认情况下的 // When a non-multipart upload or a chunked multipart upload has been // aborted, this option can be used to resume the upload by setting // it to the size of the already uploaded bytes. This option is most // useful when modifying the options object inside of the "add" or // "send" callbacks, as the options are cloned for each file upload. uploadedBytes: undefined,
例如我们可以将其修改为 100000000 (约合98MB),然后保存并退出
// To upload large files in smaller chunks, set the following option // to a preferred maximum chunk size. If set to 0, null or undefined, // or the browser does not support the required Blob API, files will // be uploaded as a whole. maxChunkSize: 100000000, //修改完成之后的数值 // When a non-multipart upload or a chunked multipart upload has been // aborted, this option can be used to resume the upload by setting // it to the size of the already uploaded bytes. This option is most // useful when modifying the options object inside of the "add" or // "send" callbacks, as the options are cloned for each file upload. uploadedBytes: undefined,
此时关闭掉原先的浏览器窗口,再打开浏览器就可以上传大于100M的文件了。