You are not logged in.
I need to provide downloads files through the browser, by click and download. The website is based on JS and retrieves from the interface based service (mORMot) links to files.
The files are on the disk and I would like them to be accessed by the mORMot server for download. Does mORMot support regular download by link?
Or how else to do it?
Offline
https://synopse.info/files/html/Synopse … ml#TITL_95
Edit: Chapter "Returning file content" in the documentation.
Last edited by sevo (2017-09-28 13:15:59)
Offline
Framework's HTTP server is able to handle returning a file as response to a method-based service.
The service is interface based
Can interface based and method based service be registered simultaneously in one http server?
Offline
Yes, you can generate links which point to a method based service.
Offline
In interface based service you can use TServiceCustomAnswer for interface function result type, see
https://synopse.info/files/html/Synopse … l#TITL_154
Offline
Which method is better? Which method does the server load less?
Offline
If you use http.sys server, then Ctxt.ReturnFile cause less overhead - it can send file contents in kernel-mode without memory copiyng.
Offline
Thx, I will try ReturnFile!
Offline
One more question. When I use parameter of TServiceCustomAnswer type in interface-based service then data transmitted will base64 encoded or binary?
Offline
You have full control on response headers and content.
Exactly what you put in TServiceCustomAnswer.Content will be sent to client, and by the HTTP server no encoding will be performed.
Offline
I captured the request (via OnRequest event) and the .Content data was encoded in base64 :-(
Offline
The TServiceCustomAnswer is for the answer, not the request - as its name states.
There is currently no way of pushing raw content to an interface-based service.
Use a method-based service, for such kind of file upload, as stated upstairs on this post.
Offline
Ok, I understand... but... would it be possible to add the ability to send data in raw mode? no encoding, binary? of course in interface-based service :-)
This would be very useful in some cases!
Please, think of it...
Offline