Upload Image using Rest api


#1

Hi all,

I am trying to upload an Image to the server using rest api, I followed couple of docs for this like, this one and this one But no matter what I try, I end up with status code 500, I checked it in rest client whether the service is working fine or not and its working perfectly there, only if I didn’t add the image then it throws me status code 500. I want some thing like this below in the request payload to work it properly .

------WebKitFormBoundaryJDEAxq1EUq1a6g4W
Content-Disposition: form-data; name="image"; filename="3DView.png"
Content-Type: image/png


------WebKitFormBoundaryJDEAxq1EUq1a6g4W--

Please help me out guys, I’m trying from last 3 days…


#2

sorry It was my mistake… The doc clearly mentioned that if a header named Content-Type is present, multipart form data will NOT be used but I was adding the Content-Type So that’s why I was facing this issue.

Thanks,


#3

I am also facing the same issue but i tried removing Content-Type multipart form data but not working.
can you share your camera options and file upload options.


#4

It is working now, actually it was my mistake.
in file upload options i put fileKey as ‘fileName’ but from my server side it was expected as ‘file’.
After renamed it to ‘file’ it is working fine. Thank you.