Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I would like to use Google Sites to create a web site, where users can upload files. These uploaded files are stored at Google Drive, and data about the file is stored in a Google spreadsheet.

Are there any open-source applications or tutorials or libraries which can help make this possible? If not, can anybody explain how to do this?

share|improve this question
    
Try Google Apps Script for that. See also Chrome Web Store for GAS apps. –  Jacob Jan Tuinstra May 9 '13 at 13:20

2 Answers 2

Maybe JotForm is a solution -> http://www.jotform.com/blog/62-Send-Your-Form-Uploads-to-Google-Drive

share|improve this answer
1  
Hi, perhaps you can put a snippet of the answer here so that this answer can stay valid when the link becomes dead? Thanks! –  Hydra May 15 '13 at 0:43

Try this code in a web app script. This code generate a Submit button and then ask for a file that the user can upload directly to a preconfigured folder of Google Drive.

var app = UiApp.createApplication();
function doGet() {

  var formContent = app.createVerticalPanel();
  formContent.add(app.createFileUpload().setName("DSRfile"));
  formContent.add(app.createSubmitButton("Start Upload"));
  var form = app.createFormPanel();
  form.add(formContent);
  app.add(form);

  return app;
}

function doPost(e){
  var DSRload = e.parameter.DSRfile;
  var folders = DriveApp.getFolders();
  while(folders.hasNext()){
    var folder = folders.next();
    if(folder.getName() === 'Expedientes'){
      var Doc = DriveApp.createFile(DSRload).getId();
      var file = DriveApp.getFileById(Doc);
      folder.addFile(file);
      break;
    }
  }

  // Display a confirmation Message
  var label = app.createLabel("File Upload Successful");
  var clickHandler = app.createServerHandler('close');
  app.add(label).add(app.createButton('close this window', clickHandler));
  Logger.log('Va a cerrar 1');
 // return app ?;OJO con esta linea activa, muestra error
}

function close(){
  //OJO No entra a esta función
  Logger.log('Va a cerrar 2');
  //return UiApp.getActiveApplication().close();
  return app.close();
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.