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

How to compare DocumentPicker.types with the picked file type to get mimeType? #584

Closed KrisLau closed 2 years ago

KrisLau commented 2 years ago

I'm trying to figure out how to figure out what file extension to put at the end of the file that i upload from react native to nodejs because I allow for picking PDFs and images. How do I do that?

I was gonna do pickedFile?. type === DocumentPicker.types.images but the value of the latter could be images/*

KrisLau commented 2 years ago

I figured it out haha just ended up using originalfilePath.split('.').pop()