react-native-documents / document-picker

Document Picker for React Native
https://react-native-documents.github.io/
MIT License
1.35k stars 437 forks source link

Unable to select archive (zip files) #256

Closed sytolk closed 4 years ago

sytolk commented 4 years ago

If I select zip file in fileExplorer it is extracted and needs to choose compressed files instead of parent .zip

Hassaan68 commented 4 years ago

I am facing same issue

bdbch commented 4 years ago

I guess thats because this library was only written to select only documents (pdf, images, text, audio, etc.)

It would be great if it was possible to send more file types since I'm facing the same issue on my side.

Hassaan68 commented 4 years ago

I guess thats because this library was only written to select only documents (pdf, images, text, audio, etc.)

It would be great if it was possible to send more file types since I'm facing the same issue on my side.

yes. i was facing this issue in ios. i have resolved this by providing more Utis to document picker for ios selection. i have declated Utis List as:

IosUtisList: [
    'public.png',
    'public.jpeg',
    'com.adobe.pdf',
    'public.data',
    'org.gnu.gnu-tar-archive',
    'public.tar-archive',
    'org.gnu.gnu-zip-archive',
    'org.gnu.gnu-zip-tar-archive',
    'public.bzip2-archive',
    'public.tar-bzip2-archive',
    'com.apple.binhex-archive',
    'com.apple.macbinary-archive',
    'com.allume.stuffit-archive',
    'public.zip-archive',
    'com.pkware.zip-archive',
    'public.content',
    'public.disk-image',
  ]

and then i passed this list to document picker as:

const res = await DocumentPicker.pick({
           //In case of ios provide custom utis list object
            type:Platform.OS==='ios'?IosUtisList:DocumentPicker.types.allFiles
        //end of res     
        });
bdbch commented 4 years ago

Does that also work with Android devices?

moddatherrashed commented 4 years ago

@Hassaan68 That does not work !! the pick function expect a string not an array ! I'm trying to pick a (.db) file which is a type (public.database) in iOS !

vonovak commented 4 years ago

hello, filtering file extensions is documented in the readme, see https://github.com/Elyx0/react-native-document-picker#typestringarraystring

and https://github.com/Elyx0/react-native-document-picker#documentpickertypes

thank you