Mobile form & sending attachment

Mobile form & sending attachment



We have a mobile app that sends form data into an external service via REST-api. Now we want that the user can take a photo and attach it to the request sent to the service.

All other fields are sent fine but we have a problem sending the attachment with the request. We use the FilePlugin to save the file taken by the camera of the mobile device. The uri shows that the file exists in (on android device): "file:///storage/emulated/0/Android/data/com.outsystemsenterprise.ourtenant.ourapp/files/ticketAttachment.png"

Our requestbody text is like this:

Content-Disposition: form-data; name=""userid""

Content-Disposition: form-data; name=""categoryId""

Content-Disposition: form-data; name=""body""

Content-Disposition: form-data; name=""subject""

Content-Disposition: form-data; name=""priorityId""

Content-Disposition: form-data; name=""uploadFile""; filename="""+FileUri+"""
Content-Type: image/png


The body above is being converted to binary before sending.

As I mentioned above everything else is sent succesfully to the service but the attachment never finds it's way to the destination and the destination service gives no error. We have tested the request with Postman and it works. We are definitely doing something wrong here but we can't figure out what. It must be connected with the file location of the mobile device.

Hi Jani,

Did you debug the output by checking the output in Service Center (after increasing the debug level)?

Kilian Hekhuis wrote:

Hi Jani,

Did you debug the output by checking the output in Service Center (after increasing the debug level)?

Hi Kilian,

Thank you for your answer.

Yes, we set the debugging level to full and it shows us "HTTP/1.1 200 OK" and correct response (the external services object id which means that the object has been created successfully) and no mention about the attachment so the request should not be completely wrong.

Here's the full log:


User-Agent: OutSystemsPlatform
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Authorization: Basic SEFNS1xqaXRiaXRhcGk6SkI9YXBpIWhhbWs=

Content-Length: 735


HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: accept, authorization, content-type
Access-Control-Allow-Credentials: true
Content-Length: 4
Cache-Control: private, s-maxage=0
Content-Type: text/html; charset=utf-8
Date: Fri, 13 Apr 2018 09:27:53 GMT
Set-Cookie: ASP.NET_SessionId=43tgqketnuxa34f1c2he12k2; path=/; secure; HttpOnly
X-Powered-By: ASP.NET



The last digit above this line is the correct object id that the external service returns.


Hi Jani,

I assume the <BINARY DATA> is the base64 encoded document?

The only other thing I could think of is some overly active firewall or anti-virus software just chopping of the attachment.