Reputation: 10844
I am trying fileupload using ajax in a struts2 framework webapp. I am using the "fileupload" interceptor in the action mapping, i am getting the file content in the action, but not the uploaded fileName i.e.,
private File file; // + its setters & getters methods.
private String fileName; // + its setter & getters methods.
System.Out.println(file.getName()); //prints some .tmp file
The fileName variable is null.
Do i have to specify any file Details while making an ajax call to get the FileName of the uploaded file ?
-- Thanks
Upvotes: 0
Views: 1033
Reputation: 1340
It should be like this
if the "name" attribute of the on your page is "xxx"
private File xxx;
private String xxxContentType;
private String xxxFileName;
Upvotes: 1
Reputation: 1125
You should provide setter method appropriately. Follow naming convention carefully. Refer above link
Upvotes: 0