flutter-form-builder-ecosystem / form_builder_image_picker

Images picker field for FlutterFormBuilder. Get images from gallery or camera
https://pub.dev/packages/form_builder_image_picker
BSD 3-Clause "New" or "Revised" License
33 stars 62 forks source link

getting filename and filetype from a value return type Uint8list #15

Closed Carlo-TMC closed 2 years ago

Carlo-TMC commented 3 years ago

Hi, I use this to upload an image using flutter web, i have trouble in getting the correct filename and the type of image, after I upload the file to fire storage, with a just supplied filename, the type is application/octet-stream. What's the proper way of uploading an image to firestorage with the filename and image type like ('image/jpeg') ?

code ` FormBuilderImagePicker( name: 'myimage', maxImages: 1, onChanged: (value) { if (value != null) { var selectedImg = value.first; imageFilename = GetIt.I .get() .uploadImage(selectedImg); } }, onSaved: (value) { vacancy.workRelatedImage = imageFilename; }, ),

` what's inside my ImageRepository is this

` String uploadImage(img) { File file = File.fromRawPath(img); String fileName = basename(file.path);

String path = 'my_images/' + fileName;

return path; `

the return path doesn't give me the correct filename. It returns special characters.

Any idea how to achieve this?

ahmednfwela commented 3 years ago

the package uses XFile to give you file information, including filename and bytes solved by #18

Carlo-TMC commented 2 years ago

Thanks, this indeed fix the problem!.