Class FileUpload

FileUpload

Deprecated. The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.

A widget that wraps the HTML <input type='file'> element. This widget must be used within a FormPanel.

The result of a FileUpload is a "Blob" which can we used in various other functions. Below is an example of how to use FileUpload.

function doGet(e) {

var app = UiApp.createApplication().setTitle("Upload CSV to Sheet");
  var formContent = app.createVerticalPanel();
  formContent.add(app.createFileUpload().setName('thefile'));
  formContent.add(app.createSubmitButton());
  var form = app.createFormPanel();
  form.add(formContent);
  app.add(form);
  return app;
}

function doPost(e) {
  // data returned is a blob for FileUpload widget
  var fileBlob = e.parameter.thefile;
  var doc = DocsList.createFile(fileBlob);
}

Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful to look at the GWT documentation directly. You can find the FileUpload documentation here.

Deprecated methods





















다음에 대한 의견 보내기...

도움이 필요하시나요? 지원 페이지를 방문하세요.