Closed pretorean closed 2 years ago
This:
final file = MultipartFile.fromString('field', content, filename: 'test_text_file.txt', );
sets the Multipart field name to be field
but the server expects it to be file
.
Similarly, image.jpg
should be file
in the following:
// final file = await MultipartFile.fromPath(
// 'image.jpg',
// './path-to-file/image.jpg',
// filename: 'image.jpg',
// contentType: MediaType.parse('image/jpeg'),
// );
Thanks it works!
π Reproduction steps
I am trying to upload a file using the code from the example and I get an error. I tried uploading a text file and a picture (commented out in the code) Maybe I'm doing something wrong?
my code:
π Expected behavior
the file should be uploaded to the server
π Actual Behavior
I see in console:
π² Appwrite version
Version 0.10.x
π» Operating system
MacOS
𧱠Your Environment
Dart SDK version: 2.14.4 (stable) (Wed Oct 13 11:11:32 2021 +0200) on "macos_x64"
π Have you spent some time to check if this issue has been raised before?
π’ Have you read the Code of Conduct?