function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Richie DRichie D 

Getting posted data in apex

Hi,

 

I have a problem to solve whereby I am receiving binarydata (a multipart form) from an HTTPPost request. This is from a third party component, but hosted within a visualforce page, to which I have little control.

 

My question is how to access the 'posted binary data' within apex? In Jsp it might be something like:-

DataInputStream in = new DataInputStream(request.getInputStream()); int formDataLength = request.getContentLength(); byte dataBytes[] = new byte[formDataLength]; int byteRead = 0; int totalBytesRead = 0;

etc...

 

 

Couldn't find any tutorials or other information about direct access to the request object and HTTPRequest seems to relate to creating my own request inside apex.

 

I have also tried to create a webservice but would need to create a SOAP request, which I can't do, so stuck there...

 

Any help appreciated.

 

Rich.