function showAlert() {
var app = UiApp.createApplication();
app.setTitle("Upload File");
var form = app.createFormPanel();
app.add(form);
var content = app.createVerticalPanel();
form.add(content);
content.add(app.createFileUpload().setName('thefile'));
content.add(app.createSubmitButton("Upload File"));
var ui = DocumentApp.getUi();
ui.showDialog(app);
}
function doPost(eventInfo) {
var app = UiApp.getActiveApplication();
var doc = DocsList.createFile(eventInfo.parameter.thefile);
var content = doc.getContentAsString();
// DO AJAX STUFF
// Optionally, this closes the dialog.
app.close();
return app;
}