Skip to content

Error :- read failed: EBADF (Bad file descriptor) when upload image. #96

Description

@Ektasahusahu

image object contain uri path :

**{
name:"6ca129ac-8a07-4838-b141-cd25126b250b"
type:"image/jpeg"
uri:"content://com.vider/external_files/Pictures/images/image-647ec492-7149-4f13-822a-4e95dc053c9e.jpg"
}**

complete source code:
const options = { keyPrefix: storagePath, bucket: 'wigbucket', region: 'us-east-1', accessKey: accessKey, secretKey: secretKey, successActionStatus: 201, // dirName: 'dev/profiles', // contentType: file.type, }; const fileObject = { uri: file.uri,//file://${file.path}`,
name: uuidv4(),
type: file.type,
};

console.log('fileObject======>ekta', fileObject, options);
return  RNS3.put(file, options)
.then(response => {
  if (response.status !== 201)
    throw new Error("Failed to upload image to S3");
  else {
    console.log(
      "Successfully uploaded image to s3. s3 bucket url: ",
      response.body.postResponse.location
    );
  }
})
.catch(error => {
  console.log(error);
});`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions