简体   繁体   English

PHP-分块上传文件

[英]PHP- Upload files in chunks

I am using fineuploader to upload files to AWS S3 , I have around 200-300 files of minimum 5MB each. 我正在使用fineuploader将文件上传到AWS S3 ,我大约有200-300个文件,每个文件至少5MB。 It is taking too much to uplaod files there. 在此处更新文件需要太多时间。 I have been looking into the documentation but there is no way to upload the files in chunks to S3 , How can I optimize my upload? 我一直在研究文档,但是无法将文件大块上传到S3 ,如何优化上传?

$('#fine-uploader-gallery_videographer').fineUploader({
                    template: 'qq-template-gallery',
                    button: $('#uploadAttachments'),
                    dragAndDrop: {
                        extraDropzones: [$('.drag-drop-main')]
                    },
                    request: {
                        endpoint: '/videographer/upload-photos',
                        params: {
                            _token: $('#vg_token').val(),
                            client_id: $('#client_id').val(),
                            baby_id: $('#baby_id').val(),
                            session_id: $('#session_id').val()
                        }
                    },
                    thumbnails: {
                        placeholders: {
                            waitingPath: '/assets/images/pics/9.jpg',
                            notAvailablePath: '/assets/images/pics/9.jpg'
                        }
                    },
                    validation: {
                        allowedExtensions: ['jpeg', 'jpg', 'gif', 'png', 'mp4', 'mov', 'avi']
                    },
                    callbacks: {
                        onUpload: function (id, name) {
                            if ($('#fine-uploader-gallery .qq-upload-list li').length > 0) {
                                $('#fine-uploader-gallery').show();
                            } else {
                                $('#fine-uploader-gallery').hide();
                            }
                        },
                        onCancel: function (id) {
                            if ($('#fine-uploader-gallery .qq-upload-list li').length > 1) {
                                $('#fine-uploader-gallery').show();
                            } else {
                                $('#fine-uploader-gallery').hide();
                            }

                        },
                        onAllComplete: function () {
                            location.reload();
                        }

                    }
                });

It is taking too much to uplaod files there 在那里更新文件需要太多时间

You have two options: 您有两种选择:

  1. Increase the bandwidth of your internet connection 增加互联网连接的带宽
  2. Increase the maxConnections option to 6 . maxConnections选项增加到6

Option 1 is the best option. 选项1是最佳选择。 Option 2 may help a bit, but probably not much if your bandwidth is the bottleneck. 选项2 可能会有所帮助,但如果带宽是瓶颈,则可能不会有太大帮助。 All browsers have a limit on the number of concurrent HTTP requests they can send. 所有浏览器都可以发送的并发HTTP请求数量有限制。 This number is usually around 6, which is where option 2 comes from. 该数字通常为6左右,这是选项2的来源。 This will tell Fine Uploader to send, at most, 6 requests at once. 这将告诉Fine Uploader一次最多发送6个请求。

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

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