Dear sir,
When I use the commons-fileupload-1.1.jar,commons-io-1.1.jar, to upload file
The file will be uploaded successfully!
But The file's name will become toLowerCase() !
Can you help me to solve this problem ?
and in the old time, When I use commons-fileupload-1.0.jar, There is
no this problem .
My server is tomcat 5027,and my os is Window XP,
below are my source code , thanks you very much !
========================================================================================
jsp1:
<%
response.setContentType("text/html; charset=utf-8");
request.setCharacterEncoding("utf-8");
%>
<form name="frmUpload" enctype="multipart/form-data" method="post" >
<input type="file" id="f1" name="File1" size="68" maxlength="20">
</form>
========================================================================================
jsp2:
<%
response.setContentType("text/html; charset=utf-8");
request.setCharacterEncoding("utf-8");
%>
<%
File tmpFile = new File("C:\\test\\");
DiskFileItemFactory factory = new DiskFileItemFactory(3000,tmpFile);
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setHeaderEncoding("utf-8");
upload.setSizeMax(20000);
List items = upload.parseRequest(request);
Iterator iter = items.iterator();
while (iter.hasNext())
{
FileItem item = (FileItem) iter.next();
if (item.isFormField())
{
}
else
{
String FileName = item.getName(); //The File name already become
toLowerCase() !
FileItem tmpItem = item;
File uploadedFile = new File("C:\\test\\"+FileName );
tmpItem.write(uploadedFile);
}
}
%>
___________________________________________________ 最新版 Yahoo!奇摩即時通訊
7.0,免費網路電話任你打! http://messenger.yahoo.com.tw/