Find Jobs
Hire Freelancers

Android HttpClient not sending more than 10 MB outofmemory issue

₹600-1000 INR

In Progress
Posted over 7 years ago

₹600-1000 INR

Paid on delivery
We were unable to send more than 10MB file to HttpServer .below is the code for sending the file. we need to send 100MB file to server. public int Sending() throws IOException { String iFileName = "[login to view URL]"; String lineEnd = "\r\n"; String twoHyphens = "--"; String boundary = "*****"; String Tag = "fSnd"; try { Log.e(Tag, "Starting Http File Sending to URL"); // Open a HTTP connection to the URL conn = (HttpURLConnection) [login to view URL](); // Allow Inputs [login to view URL](true); // Allow Outputs [login to view URL](true); // Don't use a cached copy. [login to view URL](false); //[login to view URL](5120); // Use a post method. [login to view URL]("POST"); [login to view URL]("Connection", "Keep-Alive"); [login to view URL]("Content-Type", "multipart/form-data;boundary=" + boundary); DataOutputStream dos = new DataOutputStream([login to view URL]()); [login to view URL](twoHyphens + boundary + lineEnd); [login to view URL]("Content-Disposition: form-data; name=\"title\"" + lineEnd); [login to view URL](lineEnd); [login to view URL](Title); [login to view URL](lineEnd); [login to view URL](twoHyphens + boundary + lineEnd); [login to view URL]("Content-Disposition: form-data; name=\"description\"" + lineEnd); [login to view URL](lineEnd); [login to view URL](Description); [login to view URL](lineEnd); [login to view URL](twoHyphens + boundary + lineEnd); [login to view URL]("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + iFileName + "\"" + lineEnd); [login to view URL](lineEnd); Log.e(Tag, "Headers are written"); // create a buffer of maximum size int bytesAvailable = [login to view URL](); int maxBufferSize = 5120; int bufferSize = [login to view URL](bytesAvailable, maxBufferSize); byte[] buffer = new byte[bufferSize]; // read file and write it into form... int bytesRead = [login to view URL](buffer, 0, bufferSize); // [login to view URL]([login to view URL]().size()); while (bytesRead > 0) { [login to view URL](buffer, 0, bufferSize); bytesAvailable = [login to view URL](); bufferSize = [login to view URL](bytesAvailable, maxBufferSize); bytesRead = [login to view URL](buffer, 0, bufferSize); } // while (bytesRead > 0){ // bufferSize = [login to view URL](bytesAvailable, maxBufferSize); // byte byt[]=new byte[bufferSize]; // [login to view URL](byt); // bytesRead = [login to view URL](buffer, 0, bufferSize); // [login to view URL](buffer, 0, bufferSize); // } [login to view URL](lineEnd); [login to view URL](twoHyphens + boundary + twoHyphens + lineEnd); // close streams [login to view URL](); [login to view URL](); Log.e(Tag, "File Sent, Response: " + [login to view URL]([login to view URL]())); // InputStream is = [login to view URL](); // retrieve the response from server int ch; // StringBuffer b =new StringBuffer(); // while( ( ch = [login to view URL]() ) != -1 ){ [login to view URL]( (char)ch ); } // String s=[login to view URL](); // Log.i("Response",s); [login to view URL](); } catch (MalformedURLException ex) { Log.e(Tag, "URL error: " + [login to view URL](), ex); return 0; } catch (IOException ioe) { Log.e(Tag, "IO error: " + [login to view URL](), ioe); return 0; } return [login to view URL](); }
Project ID: 11266895

About the project

1 proposal
Remote project
Active 8 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
I have been developing android programs for 4 years. I have developed many apks. So I think I can do it so that you satisfy. I am looking forward to being hired by you. I'll do my best to do it. Please award my bid and hire me. I'll make you satisfy. Believe me. And Contact to me. I can start my work at once. I'll wait your visit. Thank you!
₹2,250 INR in 3 days
5.0 (14 reviews)
3.9
3.9

About the client

Flag of INDIA
hyderabad, India
4.8
12
Payment method verified
Member since Oct 28, 2011

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759) & Freelancer Online India Private Limited (CIN U93000HR2011FTC043854)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.