Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda