sdk-for-flutter
sdk-for-flutter copied to clipboard
🐛 Bug Report:Flutter web app, createFile() not uploading the whole file
👟 Reproduction steps
I am using flutter_dropzone: ^3.0.5 to load the file,in onDrop: (dynamic ev) I added
List<int> resultValue = [];
await for (List<int> lista in controller.getFileStream(ev)) {
resultValue = resultValue + lista;
}
to create to create a List
Future<File> result = storage.createFile(
bucketId: '62fb5a75577eb6912acd',
fileId: 'unique()',
file: InputFile(
filename: '${ev.name}',
bytes: resultValue),
);
Don't believe is from the flutter_dropzone,it works as it gives me the image as List
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1889], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
X cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.5)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.70.2)
[√] Connected device (3 available)
[√] HTTP Host Availability
👍 Expected behavior
The image should be fully displayed.
👎 Actual Behavior
Part of it is showing.
🎲 Appwrite version
Different version (specify in environment)
💻 Operating system
Flutter web
🧱 Your Environment
SDK is 6.0.0 and Server is v:0.15.3.402.
👀 Have you spent some time to check if this issue has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [X] I have read the Code of Conduct
I also tried to upload a file using the playground-for-flutter, but the uploaded file seemed to be invalid after downloading it again.
I also tried to upload a file using the playground-for-flutter, but the uploaded file seemed to be invalid after downloading it again.
Yes upload works in flutter,gives no error,but downloading it from server or displaying in the 'New Window' option doesn't work.
@DobreRadu I got it working without issues, here's the code I'm using https://github.com/appwrite/playground-for-flutter/tree/feat-upgrade-latest
Let me know if this works. (I'm using getFileData instead of getFileStream) to get the file bytes.
I will try soon,thanks.
@DobreRadu I got it working without issues, here's the code I'm using https://github.com/appwrite/playground-for-flutter/tree/feat-upgrade-latest
Let me know if this works. (I'm using
getFileDatainstead ofgetFileStream) to get the file bytes.
Tried using getFileData,still doesn't work.
Future<File> result = storage.createFile( bucketId: dotenv.env['APPWRITE_BUCKET'] ?? '', fileId: 'unique()', file: InputFile( filename: '${ev.name}', bytes: await dropFileController .getFileData(ev)), );
@DobreRadu, would you be able to provide the original file you're trying to upload?

@DobreRadu, would you be able to provide the original file you're trying to upload?
Did it work ?
@DobreRadu, I was able to reproduce, but @lohanidamodar will need to test to see if he can reproduce.
Oh ok,thanks.
BTW how you can upload big size of files? I can't any upload if the size bigger than 5mb. I don't understand the content-range details with dart
@grisoftumut, thanks for your question, but please either create a new issue or join us on Discord. It can be confusing to talk about different topics in one issue.
@DobreRadu can you test from this branch? https://github.com/appwrite/sdk-for-flutter/tree/fix-flutter-web-chunked-upload
You mean updating to appwrite 8.1.0?
@DobreRadu I mean using it from fix-flutter-web-chunked-upload branch on of the SDK
Hello,tested with the appwrite 1.0 and sdk 8.1.0, it's working,thanks!
Actually not,the photo given in this thread is still not working...it's giving me an URL. I tested with a 10mb photo and is working.
Actually not,the photo given in this thread is still not working...it's giving me an URL. I tested with a 10mb photo and is working.
Are you sure? Because I ran multiple successful tests with this photo itself and other files as well, and the issue was mis-calculation which was resolved.
Yes I am sure,maybe I use a different version or something then...Thanks for the help !