GWT - image upload and GAE

2019-08-22 16:10发布

I've watched the server-side upload code example... it says next...

...
 /**
   * Get the content of an uploaded file.
   */
  @Override
  public void getUploadedFile(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String fieldName = request.getParameter(UConsts.PARAM_SHOW);
    File f = receivedFiles.get(fieldName);
    if (f != null) {
      response.setContentType(receivedContentTypes.get(fieldName));
      FileInputStream is = new FileInputStream(f);
      copyFromInputStreamToOutputStream(is, response.getOutputStream());
    } else {
      renderXmlResponse(request, response, XML_ERROR_ITEM_NOT_FOUND);
   }
  }
...

... OK, as I can see, to get file the snippet uses File object. But, as I can remember, GAE does not support the File io object. So my question is this lib OK as for GAE file upload or there is some more optimal library for GWT?

Thanks

1条回答
聊天终结者
2楼-- · 2019-08-22 16:48

There's no need to use Java IO to handle Image Upload in GAE, you can just rely on Blobstore and ImageService APIs. This tutorial has a nice explanation and an example, I followed it and my upload functionality works smoothly.

查看更多
登录 后发表回答