如何在AWS S3 javascript SDK中中止上传?

时间:2017-10-05 09:07:44

标签: amazon-web-services amazon-s3 aws-sdk

我是AWS的新手,我需要使用JS SDK取消上传过程,并且有一个代码示例,我尝试上传图片并取消上传过程:

var test = s3.upload({
                                Key: fileKey,
                                Body: myfile,
                                ACL: 'private'
                            },
                            function (err, data) {
                                if (err) {
                                } else {
                                }
                            });

                           $("#cancel_Button").on("click", function () {
                                s3.abortMultipartUpload(
                                    params = {
                                        Bucket: data.bucket,
                                        Key: data.key,
                                        UploadId: undefined
                                    },
                                    function (err, data) {
                                        if (err)
                                            console.log(err, err.stack);
                                        else
                                            console.log(data);
                                    }
                                )
                            });

0 个答案:

没有答案