-
Notifications
You must be signed in to change notification settings - Fork 266
Description
When uploading via amplify it only upload the file with content type application/octet-stream.
If you define the meta data it will only create the following instead of overriding the actual Content-Type
Content-Type: application/octet-stream ❌ (default)
x-amz-meta-contenttype: image/jpeg ✅ (custom metadata) - This should be change to Content-Type and not as user define metadata
sample code
final contentType = lookupMimeType(filename) ?? 'application/octet-stream'; final options = StorageUploadFileOptions( metadata: {'Content-Type': contentType}, ); final result = await Amplify.Storage.uploadFile( localFile: AWSFile.fromData( await file.readAsBytes(), contentType: contentType, ), path: StoragePath.fromString('yourdirectory/$filename'), options: options );