Search code examples
google-app-enginegwtfile-uploadblobstoregwtupload

GWT with Google App Engine - Upload a file


How can I upload a file using GWT with GAE? I found GWTUpload and AppEngineUploadAction class, but it can't write to the file system.

Can anyone help me?


Solution

  • GAE runs a restricted java environment, and writing to the file-system is forbidden.

    You have to select one way to store that data in GAE, gwtupload supports 3 ways to store that data in server, and it offers 3 servlets:

    • AppEngineUploadAction which will store the uploaded data in memcache. In this case the data will be lost unless you save it somewhere. This is thought as a temporary repository to process the data and send back to the client etc.
    • BlobstoreUploadAction to persist data using google blobstore service.
    • FilesApiUploadAction used to store data in the google cloud storate

    The client part of gwtupload works with all of them, but there are some issues, mainly if you dont have a bill account, google can interrupt the request. Progress doesnt work well, although new version of gwtupload plans to have progress based in html5.