I'm using file upload interceptor to upload multiple files via jsp page.
I got the file uploaded in the temp folder but in my action class all the properties (filenames, content-type, ecc) are empty!
below my code:
private List<File> fileUpload = new ArrayList<File>();
private List<String> fileUploadContentType = new ArrayList<String>();
private List<String> fileUploadFileName = new ArrayList<String>();
public List<File> getFileUpload() {
return fileUpload;
}
public void setFileUpload(List<File> fileUpload) {
this.fileUpload = fileUpload;
}
public List<String> getFileUploadContentType() {
return fileUploadContentType;
}
public void setFileUploadContentType(List<String> fileUploadContentType) {
this.fileUploadContentType = fileUploadContentType;
}
public List<String> getFileUploadFileName() {
return fileUploadFileName;
}
public void setFileUploadFileName(List<String> fileUploadFileName) {
this.fileUploadFileName = fileUploadFileName;
}
public String upload() throws Exception{
for (File file: fileUpload) {
System.out.println("File :" + file);
}
for (String fileName: fileUploadFileName) {
System.out.println("Filename : " + fileName);
}
for (String fileContentType: fileUploadContentType) {
System.out.println("File type : " + fileContentType);
}
return SUCCESS;
}
public String display() {
return NONE;
}
I need to rename all file uploaded but I can't!
Can anyone help me ???
I'm using tomcat 7.0.14 and jdk 1.6.0.25
Thanks in advance.
Best regards
struts 2.2.3 multiple file upload issuesAndrea June 7, 2011 at 8:10 PM
I'm using file upload interceptor to upload multiple files via jsp page. I got the file uploaded in the temp folder but in my action class all the properties (filenames, content-type, ecc) are empty! below my code: private List<File> fileUpload = new ArrayList<File>(); private List<String> fileUploadContentType = new ArrayList<String>(); private List<String> fileUploadFileName = new ArrayList<String>(); public List<File> getFileUpload() { return fileUpload; } public void setFileUpload(List<File> fileUpload) { this.fileUpload = fileUpload; } public List<String> getFileUploadContentType() { return fileUploadContentType; } public void setFileUploadContentType(List<String> fileUploadContentType) { this.fileUploadContentType = fileUploadContentType; } public List<String> getFileUploadFileName() { return fileUploadFileName; } public void setFileUploadFileName(List<String> fileUploadFileName) { this.fileUploadFileName = fileUploadFileName; } public String upload() throws Exception{ for (File file: fileUpload) { System.out.println("File :" + file); } for (String fileName: fileUploadFileName) { System.out.println("Filename : " + fileName); } for (String fileContentType: fileUploadContentType) { System.out.println("File type : " + fileContentType); } return SUCCESS; } public String display() { return NONE; } I need to rename all file uploaded but I can't! Can anyone help me ??? I'm using tomcat 7.0.14 and jdk 1.6.0.25 Thanks in advance. Best regards
uploading in struts2fancy March 16, 2012 at 3:51 PM
i'm trying to upload a file in struts2 but i'm getting an error : file not found exception.
ErrorWhite_King May 26, 2012 at 3:54 AM
How can i send an error message or validation error message if the file is corrupted or is not the template expected?
nice tutorialiksan June 18, 2012 at 7:40 AM
tq for this tutorial
upload imagevaibhav September 21, 2012 at 12:28 PM
i want upload image n struts2.0 when i click on the browser button then image show on imagebox. please help me.....
Post your Comment