Skip to content
Back

Upload file to Storage

  • 0
  • Self Hosted
  • Flutter
  • Storage
Max
30 May, 2025, 12:03

this working

TypeScript
  File ff = File("path/vid.mp4");
  await ff.writeAsBytes(bytes);
  // Upload file to Storage
  final fileUpload = await _storage.createFile(
    bucketId: _storageFileBucketId,
    fileId: ID.unique(),
    file: InputFile.fromPath(
      path: ff.path,
      filename: file.name,
    ),
  );
  • but when i upload from bytes final fileUpload = await _storage.createFile( bucketId: _storageFileBucketId, fileId: ID.unique(), file: InputFile.fromBytes( bytes: bytes, filename: file.name, ), );

it's uploaded file but file not working (it's no same byte size) Byte Size: 31539436

when uploaded _storage.getFileDownload(bucketId: _storageFileBucketId, fileId: fileUpload.$id).then((ss) { print("Size: ${ss.length}"); // Size: 31539429 });

TL;DR
Issue: Uploading a file from bytes results in a file with a different byte size than the original. Solution: When uploading a file from bytes, ensure the byte size remains the same by checking and adjusting the process accordingly.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more