amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

uploading issue

Open Ghazanfaru opened this issue 1 year ago • 5 comments

Description

when i upload file on aws s3 bucket sometimes it works great and file gets uploaded and when i try to upload same file more than one time then it get stuck after 2nd or 3rd try if size is small and if size is large then it get stucks in 2nd try and if size is much larger then it get stucks in first try. why would this be happening?

Categories

  • [ ] Analytics
  • [ ] API (REST)
  • [ ] API (GraphQL)
  • [ ] Auth
  • [ ] Authenticator
  • [ ] DataStore
  • [ ] Notifications (Push)
  • [X] Storage

Steps to Reproduce

No response

Screenshots

No response

Platforms

  • [X] iOS
  • [X] Android
  • [ ] Web
  • [ ] macOS
  • [ ] Windows
  • [ ] Linux

Flutter Version

3.0.0

Amplify Flutter Version

1.4.1

Deployment Method

Amplify CLI

Schema

No response

Ghazanfaru avatar Oct 19 '23 11:10 Ghazanfaru

Hey @Ghazanfaru, sorry you are facing this issue.

Can you please provide file size example from when you have observed the issue?

Can you also provide sample code and reproduction steps for the issue?

Equartey avatar Oct 19 '23 18:10 Equartey

Hey, yes, when i upload more than 100 mb file it get stuck at 90% sometime 98% sometimes 78% and the code that im using is that one which is in example on aws page i will share the code in the morning, if you really need to see that and thanks for the response.

On Thu, 19 Oct 2023 at 11:49 PM, Elijah Quartey @.***> wrote:

Hey @Ghazanfaru https://github.com/Ghazanfaru, sorry you are facing this issue.

Can you please provide file size example from when you have observed the issue?

Can you also provide sample code and reproduction steps for the issue?

— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-flutter/issues/3968#issuecomment-1771534284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT2UZLY6ET3MTMZEDVYAGNDYAFY3FAVCNFSM6AAAAAA6HA3F5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZRGUZTIMRYGQ . You are receiving this because you were mentioned.Message ID: @.***>

Ghazanfaru avatar Oct 19 '23 18:10 Ghazanfaru

Future uploadImage() async { // Select a file from the device final result = await FilePicker.platform.pickFiles( type: FileType.any, withData: false, // Ensure to get file stream for better performance withReadStream: true, );

if (result == null) {
  safePrint('No file selected');
  return;
}

// Upload file with its filename as the key
final platformFile = result.files.single;
try {
  final result = await Amplify.Storage.uploadFile(
    localFile: AWSFile.fromStream(
      platformFile.readStream!,
      size: platformFile.size,
    ),
    key: platformFile.name,
    onProgress: (progress) {
      safePrint('Uploaded: ${progress.fractionCompleted*100} %');
      safePrint("${progress.transferredBytes/ (1024 * 1024)} out of ${progress.totalBytes/ (1024 * 1024)}");
    },
  ).result;
  safePrint('Successfully uploaded file: ${result.uploadedItem.key}');
} on StorageException catch (e) {
  safePrint('Error uploading file: $e');
  rethrow;
}

} //This is the code what im using.

Ghazanfaru avatar Oct 20 '23 05:10 Ghazanfaru

Hi @Ghazanfaru, I was able to reproduce the issue and have marked it as a bug. We will investigate it further, thanks.

khatruong2009 avatar Nov 02 '23 22:11 khatruong2009

Hi @Ghazanfaru, I started working on this issue again and was not able to reproduce the issue. Are you still encountering this issue? Also, what is the use case for uploading the same file multiple times?

khatruong2009 avatar Feb 14 '24 00:02 khatruong2009

Closing due to lack of activity. Please comment here or open an issue if you experience this issue again.

Equartey avatar Mar 05 '24 21:03 Equartey