使用plupload分片上传到oss

sayhi
  • 22
uploader = new plupload.Uploader({
                            // 选择文件的按钮
                            browse_button: browse_button,
                            //请求URL
                            url: url,
                            multi_selection: multiple,
                            filters: {
                                mime_types: [ // 支持的文件类型
                                    {title: "资源文件", extensions: extension}
                                ],
                                //文件总大小
                                max_file_size: max_file_size,
                            },
                            headers: {
                                'token': token
                            },
                            chunk_size: '40MB',
                            resize: {
                                width: width,
                                height: height
                            },
                            init: {
                                FilesAdded: function (up, files) {
                                    uploader.start();
                                },
                                BeforeUpload: function (up, file) {
                                    up.setOption({
                                        multipart_params: {
                                        key: key,
                                        policy: policy,
                                        OSSAccessKeyId:OSSAccessKeyId,
                                        success_action_status: "200",
                                        callback: "",
                                        signature: signature
                                        }
                                    });
                                },
                                UploadProgress: function (up, file) {
                                },
                                FileUploaded: function (up, file, info) {
                                    var name = get_fileType(file.name);
                                    var type = get_fileType(file.name, 2);
                                    var size = getFileOfSize(file.size);
                                    var response = $.parseJSON(info.response);
                                    if (info.status == '200') {
                                        
                                        var key = domain + up.settings.multipart_params.key;
                                    } else {
                                        if (result.error == '') {
                                            result.error = '未知错误';
                                        }
                                        
                                    }
                                },
                                UploadComplete: function () {
                                                                    },
                                Error: function (up, err) {     
                                },
                            }
                        });
                        uploader.init();

php环境,分片上传到oss后获得的文件只有最后一片,比如分片大小5MB,文件大小33MB,上传完后拿到的地址看文件只有3Mb,前面的切片都没了,有大佬遇到过这个问题吗?

回复
阅读 725
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏