我看过服务器端上传code example ......接下来说......
...
/**
* 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);
}
}
...
...好吧,正如我所看到的,要获取文件,代码段使用文件对象。但是,我记得,GAE不支持File io对象。所以我的问题是这个lib OK和GAE文件上传还是有一些更优化的GWT库?
由于
答案 0 :(得分:4)
没有必要使用Java IO来处理GAE中的图像上传,您可以依赖Blobstore和ImageService API。 This tutorial有一个很好的解释和一个例子,我按照它,我的上传功能顺利运行。