我正在使用此tutorial将文件上传到我的GWT应用程序。这个文件是通过servlet上传的,每次我想保存文件或用getInputStream读取它都会收到消息:
>访问被拒绝(“java.io.FilePermission”“C:\ Users \ NESPRE~1 \ AppData \ Local \ Temp \ poifiles”“写”)
如何确保可以读取文件?谢谢!
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
...
List<FileItem> items = upload.parseRequest(req);
if (item.isFormField())
continue;
String fileName = item.getName();
if (fileName != null) {
fileName = FilenameUtils. getName(fileName);
}
File uploadedFile = new File(UPLOAD_DIRECTORY, fileName);
if (uploadedFile.createNewFile()) //throw the exception here
}