ImagePicker file name and mime-type


#1

How can i get name and mime-type using ImagePicker? In url i creates a copy of file with hash-name, but i need original name


#2

The API doesn’t currently return the image name, the name would not generally be useful because it is auto generated by the system (unless loaded by user onto an Android phone). Can you describe the case where returning the original name would be useful? We may consider adding it into a future release.

The mime-type can be inferred from the extension on the uri returned in the result, but is not returned in the result.


#3

I’m going to do image upload on server, so on site you can see image preview and it’s name a the bottom of it. I have found document picker with the type image/*, it returns right name, but I’m still unable to upload it because it’s uri starts with protocol content://


#4

In general there is no well-defined name from the OS for an image that the user picks. You could have the user enter a name manually and just use that. Images are mostly just blobs of color data, with some metadata such as exif stuff (orientation, information about the camera, or such), but when a person takes a photo and saves it on the phone, what would be a nice name for it?


#5

I agree that camera photos will have generated name, but not hash. Like IMG_201709010852


#6

How would this be more useful than 'IMG_' + Math.random(4000)?