Hello all,
I have a simple html form which has an <INPUT TYPE="FILE"/> field in it.
Now when I select a file that contains Scandanavian characters (such as
umlauts) it is not being URL encoded properly before being sent. As a
result, my jsp page which accepts posts of files via the FileUpload package
is not interpreting the file name correctly.
Has anyone seen this problem, first? And does anyone have a solution for
this issue?
For example, if I select a file say:
filename="C:\Documents and Settings\Robert.Priest\Desktop\���.txt"
what is sent in the request is:
C:\Documents and Settings\Robert.Priest\Desktop\???.txt"
and what is seen by if you do a FileItem.getName() is:
C:\Documents and Settings\Robert.Priest\Desktop\???.txt
So the method FileUploadBase.getFileName(Map /* String, String */ headers)
does not see the correct filename when it executes:
if (start != -1 && end != -1)
{
fileName = cd.substring(start + 10, end).trim();
}
The following is the multipart requests that IE sends using such a file
(with umlauts) in the name:
------------------------------
POST /jsp/upload.jsp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-
powerpoint, application/vnd.ms-excel, application/msword,
application/x-shockwav
e-flash, */*
Referer: http://localhost:8080/roberttest/rptest.html
Accept-Language: en-us
Content-Type: multipart/form-data;
boundary=---------------------------7d39eb580
29a
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: localhost:2000
Content-Length: 349
Connection: Keep-Alive
Cache-Control: no-cache
-----------------------------7d39eb58029a
Content-Disposition: form-data; name="oFile1"; filename="C:\Documents and
Settin
gs\Robert.Priest\Desktop\???.txt"
Content-Type: application/octet-stream
-----------------------------7d39eb58029a
Content-Disposition: form-data; name="TestValue"
AAAAA
-----------------------------7d39eb58029a--
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]