Reputation: 665
Im using react-google-picker for my react app to open google drive and i want to open only specific doc types(doc, docx, txt) in file picker.
Documentation (https://www.npmjs.com/package/react-google-picker) provide file types for images but not for others.
mimeTypes={['image/png', 'image/jpeg', 'image/jpg']}
I found the file type for text is as
mimeTypes={['text/doc']}
Could anyone please help me to find exact file types for doc and docx
Following is the way i load picker component
<GooglePicker clientId={'xxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com'}
developerKey={'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}
scope={['https://www.googleapis.com/auth/drive.readonly']}
onChange={data => this.uploadDriveFile(data)}
onAuthenticate={token => this.setGoogleDriveToken(token)}
onAuthFailed={data => console.log('on auth failed:', data)}
multiselect={false}
navHidden={false}
authImmediate={false}
mimeTypes={["text/doc"]}
query={''}
viewId={'DOCS'}>
<button> open google drive </button>
</GooglePicker>
Upvotes: 1
Views: 198
Reputation: 665
I found the file types for doc and docx also
mimeTypes={["text/plain", "application/vnd.google-apps.document", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/msword"]}
where
"application/vnd.google-apps.document", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
both belongs to docx and
application/msword
belongs to doc
Upvotes: 4