28

I've tried react-native-file-picker, react-native-file-chooser, react-native-document-chooser etc, but none of them are working properly. Can anyone suggest me a good functional file picker for choosing files from device storage?

Dave
  • 5,108
  • 16
  • 30
  • 40
ajithes1
  • 433
  • 2
  • 11
  • 28
  • These sorts of questions are off-topic on SO because they tend to attract opinionated answer. Please read [ask] for more info. – bennygenel Mar 29 '18 at 09:53
  • ThEsE sOrTs Of QuEsTiOnS aRe OfF-tOpIc On So BeCaUsE tHeY tEnD tO aTtRaCt OpInIoNaTeD aNsWeR. pLeAsE rEaD hOw To AsK fOr MoRe InFo. – blimpse Dec 17 '21 at 17:47

2 Answers2

29

On a personal opinion, I use react-native-document-picker.

The installation and the usage is well mentioned in their docs

Right now it supports most general use cases required for file upload

  • All type of Files 'public.allFiles' or DocumentPickerUtil.allFiles()
  • Only PDF 'public.pdf' or DocumentPickerUtil.pdf()
  • Audio 'public.audio' or DocumentPickerUtil.audio()
  • Plain Text 'public.plainText' or DocumentPickerUtil.plainText()

The rest of the restrictions can be modified based upon your file type option as it provides with the following file res options

 res.uri,
 res.type, // mime type
 res.fileName,
 res.fileSize
Ramesh R
  • 7,009
  • 4
  • 25
  • 38
Pritish Vaidya
  • 21,561
  • 3
  • 58
  • 76
  • I've already tried it. You have any other suggestions? – ajithes1 Mar 29 '18 at 08:18
  • For my `use case` this was the best suited, you may define your `use case` – Pritish Vaidya Mar 29 '18 at 08:20
  • 4
    And what about photo and video picker support in this lib? As far as I know in iOS it is different framework for picking photo and video. – Tony Jul 04 '18 at 18:38
  • Can you also add an example of how it works? I tried with wrapping the DocumentPicker.show() in method in a function that is called when clicking an icon and it doesn't work. It throws an error that DocumentPicker is undefined. – monchisan Aug 30 '18 at 13:11
  • That error generally means your `DocumentPicker` is not linked correctly, try linking manually as mentioned in the docs. – Pritish Vaidya Aug 30 '18 at 14:32
  • I am facing the issue on android , executed all the linking steps as mentioned in the docs. see ( https://github.com/Elyx0/react-native-document-picker/issues/196 ), any help is greatly appreciated. – Badrinath Mar 25 '19 at 15:50
  • You also need to update `MainApplication.java`. Then clean-rebuild-run – Pritish Vaidya Mar 25 '19 at 16:12
  • @PritishVaidya is it possible to pick and get path for emty folder (not a file) with react-native-document-picker? – Stich Jun 19 '19 at 11:37
  • @PritishVaidya How we can open document picker UI from our given specific directory? Plz help me out with this. – Muhammad Rafeh Atique Oct 26 '20 at 04:29
  • I am getting error as > Task :react-native-document-picker:compileDebugJavaWithJavac FAILED ain/java/io/github/elyx0/reactnativedocumentpicker/DocumentPickerModule.java:185: error: cannot find symbol – Sadanand Jun 13 '21 at 05:46
0

I use react-native-file-picker, because It can select all the files in the phone. But react-native-document-picker has a very limited selection of files

xiaohe
  • 1
  • 3
    The problem with react-native-file-picker is it does not currently work on iOS. They recommend using react-native-document-picker – Dror Bar Jul 23 '19 at 12:52
  • @DrorBar But it's not work in ios also :=( I couldn't select any file "not responding" – Oliver D Sep 16 '20 at 15:09