Upload files greater than 2MB on Private Cloud - HTTP Reques

Posted by IramK on 02-Dec-2014 11:19

Hello,

I have carried out uploading files onto Rollbase (Trial account and Private Cloud) with files less than 2MB. I am trying to upload files greater than 2MB over private cloud using the code given here: https://community.progress.com/community_groups/rollbase/f/25/t/14028.aspx?pi20882=2#50394. Since HTTP request body uses multipart form data to process larger files, I am trying to build the request body to send the POST data. When trying to do that, I am getting an error: "Corrupt form data: premature ending" Could you guys let me know on where I am going wrong?

POST http://privatecloud.com/rest/api/setDataField HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
Content-Type: multipart/form-data; boundary=----=_Part_2_5070931.1417531039501
Host: privatecloud.com
Content-Length: 342
Expect: 100-continue

----=_Part_2_5070931.1417531039501
Content-Disposition: form-data; name=\file\; filename=\TestFile\
Content-Type: text/plain

&sessionId=73928cdf928848ad9d6a9dbeb1058e96@1&objName=demoAttachment&id=39898&fieldName=file&fileName=Hello World.txt&output=xml&value=SGVsbG8gV29ybGQh&contentType=text/plain
----=_Part_2_5070931.1417531039501

Error:

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Content-Length: 116
Date: Tue, 02 Dec 2014 17:16:41 GMT
Connection: close

<?xml version="1.0" encoding="UTF-8" ?>
<resp status="fail">
<err>Corrupt form data: premature ending</err>
</resp>

Posted by IramK on 03-Dec-2014 08:35

Managed to solve it by change the POST HTTP request body to the following given below:

POST http://privatecloud.com/rest/api/setDataField HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/form-data; boundary="----=_Part_0_2215605.1417599940206"
MIME-Version: 1.0
Content-Length: 22311
Host: privatecloud.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="sessionId"

f2d1dab5b6f843feb71344e437a2df88@1
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="objName"

demoAttachment
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="fieldName"

file
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="contentType"

text/plain
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="fileName"

Book.xlsm
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="output"

xml
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="id"

20936
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Content-Disposition: form-data; name="value"

UEsDBBQABgAIAAAAIQCsmTVRbwEAAD8EAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAA=
C AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
AAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
------=_Part_0_2215605.1417599940206--


All Replies

Posted by pvorobie on 02-Dec-2014 11:29

This may be Apache configuration issue.

Posted by Godfrey Sorita on 02-Dec-2014 12:13

Hi Iram,

Have you tried increasing the file size limit of the field to be updated? If yes, can you please confirm whether or not you are still using the same code used on the previous thread?

Thanks,
Godfrey

Posted by IramK on 03-Dec-2014 03:14

Yes I have tried increasing the file size limit of the file to be updated on both Rollbase and the server configuration but I still get the same error. I am using the same code that I used on the previous thread and it works for files less than or equal to 1.3 MB but doesn't work beyond that.

Posted by IramK on 03-Dec-2014 08:35

Managed to solve it by change the POST HTTP request body to the following given below:

POST http://privatecloud.com/rest/api/setDataField HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/form-data; boundary="----=_Part_0_2215605.1417599940206"
MIME-Version: 1.0
Content-Length: 22311
Host: privatecloud.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="sessionId"

f2d1dab5b6f843feb71344e437a2df88@1
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="objName"

demoAttachment
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="fieldName"

file
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="contentType"

text/plain
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="fileName"

Book.xlsm
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="output"

xml
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: form-data; name="id"

20936
------=_Part_0_2215605.1417599940206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Content-Disposition: form-data; name="value"

UEsDBBQABgAIAAAAIQCsmTVRbwEAAD8EAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAA=
C AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
AAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
AAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
------=_Part_0_2215605.1417599940206--


Posted by Godfrey Sorita on 03-Dec-2014 08:41

Hi Iram,

Thank for sharing the solution for this issue.


Godfrey

This thread is closed