Issue
I'm trying to transfer big file to the server using httpput. However, I can't to transfer big files. I get IOException with error message: "I/O error during system call, Connection reset by peer". I'm using the code:
// create authenticate client
DefaultHttpClient client = new DefaultHttpClient(httpParameters);
// create HTTP put with the file
HttpPut httpPut = new HttpPut(url);
final File recordingFile = new File(mDir, mName);
FileEntity entity = new FileEntity(recordingFile, "binary/octet-stream");
entity.setChunked(true);
httpPut.setEntity(entity);
httpPut.addHeader("Connection", "Keep-Alive");
httpPut.addHeader("Content-Type", "application/zip");
// Execute
HttpResponse res = client.execute(httpPut);
int statusCode = res.getStatusLine().getStatusCode();
Solution
When sending file through http remember that your server http has a max-limit to dimension of the file.
If i'm not wrong the default value is 2MB: but you can change this on the configuration file of the server (PHP).
The file to check is php.ini.
Open the file and search for 'upload_max_filesize = 2M': simply change 2 with the dimension you need for your project and save.
That's all!
Answered By - Davide Lorenzi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.