Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

178
Vistas
Is it possible to upload to root of sub-folders with Google picker?

We have a working google file picker but our users gets confused by having to select the folders and not being able to save in the root of the current folder they are at. Is there some option that can be used to change the behaviour of the picker so that is possible? Or maybe a different approach entirely?

This is a small snippet of the angular code that sets up the behaviour of the google picker:

    const pickerBuilder = new google.picker.PickerBuilder();

    view = new google.picker.DocsView()
      .setParent('root')
      .setIncludeFolders(true);
    view.setMimeTypes('application/vnd.google-apps.folder')
      .setSelectFolderEnabled(true);
    picker = pickerBuilder
      .enableFeature(google.picker.Feature.NAV_HIDDEN)
      .setOAuthToken(this.oauthToken.access_token)
      .addView(view)
      .addView(new google.picker.DocsUploadView());
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

How about creating a picker for selecting the folder, and when the file is selected, create a new instance of the picker with the DocsUploadView and set the parent via DocsUploadView.setParent(string) to the one the user chose.

Just a sketch on how this may be accomplished:

First we create two functions two render the different pickers
function createPickerFolders() {
  const view = new google.picker.DocsView()
    .setIncludeFolders(true)
    .setSelectFolderEnabled(true)
    .setMimeTypes("application/vnd.google-apps.folder");

  const picker = new google.picker.PickerBuilder()
    .addView(view)
    .setAppId(appId)
    .setOAuthToken(oauthToken)
    .setCallback(pickerViewCallback)
    .build();
  picker.setVisible(true);
}

function createPickerUpload(folderId) {
  const view = new google.picker.DocsUploadView().setParent(folderId);

  const picker = new google.picker.PickerBuilder()
    .addView(view)
    .setAppId(appId)
    .setOAuthToken(oauthToken)
    .setCallback(pickerUploadCallback)
    .build();

  picker.setVisible(true);
}
For the callback of the DocsView we create one that renders the DocsUploadView and sets it's parent to the folder selected
function pickerViewCallback(data) {
  if (data.action == google.picker.Action.PICKED) {
    const folderId = data.docs[0].id;
    createPickerUpload(folderId);
  }
}

In this way we achieve that the folder selected by the user, is the one to which the file is uploaded.

Documentation:
  • DocsUploadView
  • DocsView
about 4 years ago · Juan Pablo Isaza Denunciar

0

Basically we ended up giving our users 2 options:

  • Save to root
  • Save to folder

not an optimal solution but it made it possible to save in the root AND by having the save text mention folder it would give the user a hint about how the regular save feature works.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda