androidquery/androidquery — pull request #20 by free1002 (2012-06-11 09:15:47+00:00)
Title: setting right filename in Content-Disposition part

About :
When I had tried to upload a file, I found that the file name passed is wrong. This patch fixed that problem.

Analysis :
At file uploading, android-query uses writeData method and it is implemented like this :

private static void writeData(DataOutputStream dos, String name, InputStream is) throws IOException {

dos.writeBytes(twoHyphens + boundary + lineEnd);
dos.writeBytes("Content-Disposition: form-data; name=\""+name+"\";"
+ " filename=\"" + name + "\"" + lineEnd); <------ 'name' means form name, not file name
dos.writeBytes(lineEnd);

AQUtility.copy(is, dos);

dos.writeBytes(lineEnd);
}