Posting file with ClientHTTPConnection

Hi,

I have been trying to upload a file using the HTTP post method for, and the ClientHTTPRequest class made available on the web at:

http://www.devx.com/Java/Article/17679/0/page/3

by its author, for more than a day. I am calling post, but the file is not being posted. The file should, according to the doc, be attached by act of using a the setRequestParameter method for a file value. No luck please help.

The relevant portion of my code is:

req.setParameter("Filename", testFile );

req.setParameter("Content-Type:", "multipart/form-data; boundary=" + req.boundary);

req.setParameter("Content-disposition", "form-data; name=\"Log\"; filename=C:\\finalFile.txt");

InputStream is = req.post("filename", testFile);

Thanks,

[785 byte] By [Turennea] at [2007-11-27 8:57:02]
# 1

Please ignore.

The problem turned out to be a server side issue. I was writing the client, and the people on the server side were blaming me. Of course, I've been the one blaming other people for my mistakes often enough, so I guess it evens out.

Good luck and thanks for looking at this.

Turennea at 2007-7-12 21:20:58 > top of Java-index,Core,Core APIs...