简体   繁体   English

GWT-图片上传和GAE

[英]GWT - image upload and GAE

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. ...确定,如我所见,要获取文件,代码段使用File对象。 But, as I can remember, GAE does not support the File io object. 但是,我记得,GAE不支持File io对象。 So my question is this lib OK as for GAE file upload or there is some more optimal library for GWT? 所以我的问题是,对于GAE文件上传来说,这个库还可以吗?或者对于GWT,还有一些更好的库?

Thanks 谢谢

There's no need to use Java IO to handle Image Upload in GAE, you can just rely on Blobstore and ImageService APIs. 无需使用Java IO在GAE中处理图片上传,您只需依赖BlobstoreImageService API。 This tutorial has a nice explanation and an example, I followed it and my upload functionality works smoothly. 本教程有一个很好的解释和一个示例,我按照它进行了讲解,并且我的上传功能正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM