• Post Reply Bookmark Topic Watch Topic
  • New Topic

Upload large text files via URLConnection  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I'm using the following method to upload a text file to a server:



This works great, except the case when the text file is large. When i try to upload an 50 MB text file, I get OutOfMemoryException at URLEncoder.encode...
It works, if i increase the heap size to around 450 MB, but it is too much sacrifise.

Is there any more efficient method than can handle large files? Note that i want to upload the file as text, not as a file.

Thanks

 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. But that is too difficult a question for beginners. Moving.
 
Gabriel Beres
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved the probem, by uploading the file as a multipart file, instead of request parameter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!