# java.lang.OutOfMemoryError multipart file upload

**URL:** <https://forum.katalon.com/t/java-lang-outofmemoryerror-multipart-file-upload/59521>\
**Category:** Bug Report\
**Tags:** tracked, bugs-report, katalon-studio\
**Created:** [October 27, 2021, 4:03am UTC](https://forum.katalon.com/t/java-lang-outofmemoryerror-multipart-file-upload/59521 "2021-10-27T04:03:22Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 9, 2021, 11:15pm UTC](https://forum.katalon.com/t/java-lang-outofmemoryerror-multipart-file-upload/59521/10 "2021-11-09T23:15:32Z")

</div>

As far as I read the source of Katalon Studio’s WS keywords, they are not well-designed and well-tested to process multipart/form-data.

1. As the following post tells, it has a bug in String encoding.

- [Katalon POSt Request with multipart/form-data and formdata fields conrtains utf-8 text not submittd the text in the same format](http://forum.katalon.com/t/katalon-post-request-with-multipart-form-data-and-formdata-fields-conrtains-utf-8-text-not-submittd-the-text-in-the-same-format/59390/7)

I would not be surprised if they raise OutOfMemoryError when you try to upload a multipart/form-data that comprises with binary data.

1. I would rather advise you to stop using Katalon Studio if you seriously want to upload your files.

2. @wade.ward mentioned that he successfully uploaded the 2GB file using Postman. Then, @sahib.s.virk, why not you use Postman? ==\> @Jass @duyluong

3. Katalon Studio bundles the Apache HttpClient libraries as `.classpath` file shows:

```auto
	<classpathentry kind="lib" path="/Applications/Katalon Studio.app/Contents/Eclipse/plugins/org.apache.httpcomponents.httpclient_4.5.1.jar"/>
	<classpathentry kind="lib" path="/Applications/Katalon Studio.app/Contents/Eclipse/plugins/org.apache.httpcomponents.httpcore_4.4.4.jar"/>
	<classpathentry kind="lib" path="/Applications/Katalon Studio.app/Contents/Eclipse/plugins/org.apache.httpcomponents.httpmime_4.5.1.jar"/>

```

Therefore you can write a Groovy script in Katalon Studio that uploads files using the Apache HttpClient libs directly. I guess that approach would be rather hopeful.

1. The following code is my sample Test Case script in my Katalon Studio project.

- [https://github.com/kazurayam/OutOfMemoryErrorWhileUploadingVeryLargeMultipartFormData/blob/master/Scripts/POST\_request\_using\_Apache\_httpclient/Script1635600023664.groovy](https://github.com/kazurayam/OutOfMemoryErrorWhileUploadingVeryLargeMultipartFormData/blob/master/Scripts/POST_request_using_Apache_httpclient/Script1635600023664.groovy)

This code shows how to write a HTTP client using Apache HttpClient library that uploads 1.8GB file as mime multipart/form-data. This client worked for me. However the [HttpServer](https://github.com/kazurayam/OutOfMemoryErrorWhileUploadingVeryLargeMultipartFormData/blob/master/server.groovy) that I wrote was dum, and Timeout occurred while transferring a large file of 1.8GB. I failed to finish uploading the file using this pair of client/server 😣 , but I am not going to work on it any longer

@duyluong

Could you look into this?

---

_[View the full topic](https://forum.katalon.com/t/java-lang-outofmemoryerror-multipart-file-upload/59521)._
