I dont know how to upload a file with the PostMethod (btw uploading files
with the PutMethod worked great, but i need to upload large files)

I have read the whole day and didnt find anything that could help me. The 
code i have so far should upload the local file 'local=/home/my/file.a' to
the url 'http://loclahost:8080/username/file.b' (because different names
should be possible)


PostMethod method2 = null;
try {
        System.out.println();
        method2 = new PostMethod(url + "/" + remote);
        Part[] parts = {
                new FilePart(local.getName(), local)
        };
        method2.setRequestEntity(
                new MultipartRequestEntity(parts, method2.getParams())
        );
} catch (FileNotFoundException e) {
        log.warning("File doesnt exist: " + local);
        e.printStackTrace();
        return false;
}
try {
        // Execute the
method.
        
httpclient.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
int statusCode = httpclient.executeMethod(method2);
if (statusCode != HttpStatus.SC_OK) {
        log.warning("PostMethod failed: " + method2.getStatusLine() + "
Statuscode="+statusCode);
                        } else {
.
.
.



But this doesnt work. And i really Dont know if this is a client or server
side problem. As server i use jetty, but jetty is capable of handling
multipart/form. On the serverside i only added a HttpContext.


Thx for any help
Bastian




-- 
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to