I'm trying to do upload a file using struts2 file tag. Followed all the
mentioned as given in
http://struts.apache.org/2.0.11/docs/file-upload-interceptor.html. but still
am not able to retreive the file contents in my action class. Below is the
code snippet which i added.
ApplicationResources.properties
struts.messages.error.uploading=a general error that occurs when the file
could not be uploaded
struts.messages.error.file.too.large=occurs when the uploaded file is too
large
struts.messages.error.content.type.not.allowed=occurs when the uploaded file
does not match the expected content types specified
Struts.xml
/jsp/success.jsp
MyAction.java
import java.io.File;
//The below properties with getter and setter methods defined
private File subUploadFile; // The actual file
private String uploadContentType; // The content type of the file
private String uploadFileName; // The uploaded file name and path
public String uploadFile() throws Exception {
System.out.println("Inside uploadFile() .....");
System.out.println("File : " + getSubUploadFile());
System.out.println("File Name : " + getUploadFileName());
System.out.println("Content type : " + getUploadContentType());
return SUCCESS;
}
myForm.jsp
All the S.O.P. are printing null
--
View this message in context:
http://www.nabble.com/Struts2%3A-file-upload-not-working---Help-plzzzzzz-tp22971111p22971111.html
Sent from the Struts - Dev mailing list archive at Nabble.com.