Rick, My website (mostly reactjs) needs the photos for menu items like Snickers candy bars. I know the website can not see the server's hard drive. The photos are stored on a server and the website can determine the name by something like
Yes you can return non-JSON responses from a REST service:
FUNCTION RestReturnPdf()
*** Force non-JSON response
THIS.oJsonService.IsRawResponse = .T.
Response.ContentType = "application/pdf"
*** File needs to be in the `/web` folder hierarchy
lcFilename = THIS.ResolvePath("~/policy.pdf")
*** Send from memory - string/blob
lcFile = FILETOSTR(lcFilename)
Response.BinaryWrite( lcFile )
*** Send from file
*!* Response.TransmitFile(lcFilename,"application/pdf")
ENDFUNC
Incidentally I added a new lRawResponse
property to the wwRestProcess
class that basically forwards to the THIS.oJsonService.IsRawResponse
to have a more easily discoverable direct property to use.
It'll be in the next update.
+++ Rick ---