Reputation: 2330
I have implemented Angular Google Picker google Picker. Can I apply, user can only select pdf and doc from google picker no other file.
Please help me to do this.
Upvotes: 1
Views: 415
Reputation: 17651
You certainly can. PDFs, Spreadsheets, Images are examples of mimetypes. You can control the View of your MiMEType preference by using google.picker.ViewId. + MiMEType. Example:
- Adobe PDF files stored in Google Drive is google.picker.ViewId.PDFS
- Google Drive photos is google.picker.ViewId.DOCS_IMAGES Google Drive
- Documents is google.picker.ViewId.DOCUMENTS
I played with this and displayed the Folders (in your case, PDFs) using
function createPicker() {
// Create a view to search Folders.
var view = new google.picker.View(google.picker.ViewId.FOLDERS);
// Use DocsUploadView to upload documents to Google Drive.
var uploadView = new google.picker.DocsUploadView();
var picker = new google.picker.PickerBuilder().
addView(view).
setAppId(appId).
setOAuthToken(oauthToken).
setCallback(pickerCallback).
build();
picker.setVisible(true);
}
For you, use this line instead:
var view = new google.picker.View( google.picker.ViewId.PDFS);
I used plain JS for this, it's up to you to implement in Angular.
Upvotes: 2