hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Becke <be...@u.washington.edu>
Subject Re: SocketException While Uploading Large File With MultipartPostMethod
Date Wed, 26 Feb 2003 03:24:46 GMT
There is no real limit on the file size.  I've done it with a 300MB  
file with no problem.  The error could be on the server side.  Any idea  
what is happening there?  What are you posting to?

Mike

On Tuesday, February 25, 2003, at 10:04 PM, Daniel Walsh wrote:

> As I mentioned in a previous posting (Subject: MultipartPostMethod  
> Holding File Stream Open?), I'm using the MultipartPostMethod to  
> upload a file to a servlet.  Here is the example code that I included  
> in the other posting:
>
>> File file = new File(strUrl);
>>
>> HttpClient client = new HttpClient();
>> HostConfiguration hostConfig = new HostConfiguration();
>> MultipartPostMethod mpPost = new MultipartPostMethod();
>>
>>  hostConfig.setHost(someURL.getHost(), someURL.getPort(),
>> someURL.getProtocol());
>> client.setConnectionTimeout(30000);
>> client.setHostConfiguration(hostConfig);
>>
>> mpPost.addParameter("someName", "someValue");
>> mpPost.addParameter(file.getName(), file);
>>
>> mpPost.setPath(strPath);
>> client.executeMethod(mpPost);
>>
>> String confirmUpload = tpPost.getResponseBodyAsString();
>> mpPost.releaseConnection();
>
> I've been uploading some small text files (about 14KB each) and it  
> seems to work properly in this situation.  However, when I try to do  
> the same with a 20MB file (I realize that this is a very large file,  
> however, I want to test it's performance) a SocketException is thrown.
>
> java.net.SocketException: Software caused connection abort: socket  
> write error
>         at java.net.SocketOutputStream.socketWrite0(Native Method)
>         at  
> java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
>         at  
> java.net.SocketOutputStream.write(SocketOutputStream.java:126)
>         at  
> org.apache.commons.httpclient.methods.multipart.FilePart.sendData(FileP 
> art.java:198)
>         at  
> org.apache.commons.httpclient.methods.multipart.Part.send(Part.java:197 
> )
>         at  
> org.apache.commons.httpclient.methods.MultipartPostMethod.writeRequestB 
> ody(MultipartPostMethod.java:203)
>         at  
> org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBas 
> e.java:1974)
>         at  
> org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodB 
> ase.java:2298)
>         at  
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.jav 
> a:915)
>         at  
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: 
> 557)
>         at  
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java: 
> 474)
>         at test.FileUploader.upload(FileUploader.java:179)
>         at test.FileUploader.main(FileUploader.java:341)
>
> Is there some kind of cap on the file size that I can send?  If so, at  
> what size is the cap set?
>


Mime
View raw message