DEV Community

MOHSIN ALI SOOMRO
MOHSIN ALI SOOMRO

Posted on • Updated on

Upload image in reactjs to aws s3 bucket

var upload = new AWS.S3.ManagedUpload({
    params: {
        Bucket: "backstageclass-storage",
        Key: file.name,
        Body: file
        }
    })
var promise = upload.promise()
promise.then(
                function(data) {
                    alert("Successfully uploaded photo.");
                    console.log(data,'Data')
                },
                function(err) {
                    return alert("There was an error uploading your photo: ",);
                }
            );
Enter fullscreen mode Exit fullscreen mode

Top comments (0)