<s:form action="resultAction" namespace="/"
method="POST" enctype="multipart/form-data">
<s:file name="fileUpload" label="Select a File to upload" size="40" />
<s:submit value="submit" name="submit" />
</s:form>
public String execute() {
try {
String filePath = servletRequest.getRealPath("/");
System.out.println("Server path:" + filePath);
File fileToCreate = new File(filePath, this.userImageFileName);
FileUtils.copyFile(this.userImage, fileToCreate);
} catch (Exception e) {
e.printStackTrace();
addActionError(e.getMessage());
return INPUT;
}
return SUCCESS;
}
Мой файл получает preview.it хранится в папке C: \ Users \ Nirmala.netbeans \ 6.8 \ GlassFish_v3 \ generate \ jsp \ strutsfileupload \ uploa d_4877f322_130a84c40c4__7fd1_00000001.tmp, но я не могу найти его в моемкаталог.