我有一个简单的表格来上传文件,它显示带有 tmp 扩展名的文件名,但不显示上传文件的实际名称。
JSP
<s:form id="uploadCSV" method="POST" action="add" enctype="multipart/form-data">
<s:file name="csv" label="Upload File"/>
<s:submit/>
</s:form>
爪哇
private File csv;
private String contentType;
private String fileName;
private String filename;
private String FileName;
private String Filename;
..... all getter setters here .....
System.out.println("file:" + fileName); <<null
System.out.println("Name >>>>" + this.csv.getName()); << upload_344f45f4f54f5f5_54r5r4000.tmp
System.out.println("Name >>>>" + this.contentType); << null
System.out.println("Name >>>>" + this.FileName); << null
System.out.println("Name >>>>" + this.Filename); << null
System.out.println("Name >>>>" + this.filename); << null