No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
When you tag a ViewModelColumn with BlobDownloadLink = true - the UI will render this as a download. | When you tag a ViewModelColumn with BlobDownloadLink = true - the UI will render this as a download link. | ||
===== File content ===== | |||
It will use a call to GetVMFile on the turnkey server to allow for a download of content type application/octet-stream. | |||
If your request has '''accept-encoding:gzip''' set - then we will gzip the file on the server before sending it back. | |||
===== Content type ===== | |||
If your ViewModelColumn for data is "MyColumn" - and you add a ViewModelColumn called '''MyColumn_ContentType''' on the same viewmodel nesting (this need not be shown but must exist) - and that attribute is of type string - then the GetVMFile will use this content type when downloading the file (must follow web standards https://www.sitepoint.com/mime-types-complete-list/). | |||
===== File name ===== | |||
The ViewModelColumn that was tagged with BlobDownloadLink may be accompanied by a '''FileName''' column. '''Note!''' '''Case sensitive.''' | |||
If your tagged columns was MyColumn - and you add a '''MyColumn_FileName''' on the same nesting (this need not be shown on screen but must exist in the viewmodel) - and that column is of type string - then the GetVMFile will mark the response as attachment with a set file name. | |||
Note that the filename is set during upload so this column need to exist in the upload view model. | |||
===== Response headers ===== | |||
The server will tag the response header like this when downloading like this; | |||
content-encoding:gzip | |||
content-length:16660 | |||
content-type:application/octet-stream | |||
The content-length will in this case be the zipped length | |||
If you want control of exactly how the GetVMFile URL is formed, look at [[The ExternalId explained]] | If you want control of exactly how the GetVMFile URL is formed, look at [[The ExternalId explained]] | ||
Revision as of 11:37, 11 July 2020
When you tag a ViewModelColumn with BlobDownloadLink = true - the UI will render this as a download link.
File content
It will use a call to GetVMFile on the turnkey server to allow for a download of content type application/octet-stream.
If your request has accept-encoding:gzip set - then we will gzip the file on the server before sending it back.
Content type
If your ViewModelColumn for data is "MyColumn" - and you add a ViewModelColumn called MyColumn_ContentType on the same viewmodel nesting (this need not be shown but must exist) - and that attribute is of type string - then the GetVMFile will use this content type when downloading the file (must follow web standards https://www.sitepoint.com/mime-types-complete-list/).
File name
The ViewModelColumn that was tagged with BlobDownloadLink may be accompanied by a FileName column. Note! Case sensitive.
If your tagged columns was MyColumn - and you add a MyColumn_FileName on the same nesting (this need not be shown on screen but must exist in the viewmodel) - and that column is of type string - then the GetVMFile will mark the response as attachment with a set file name.
Note that the filename is set during upload so this column need to exist in the upload view model.
Response headers
The server will tag the response header like this when downloading like this;
content-encoding:gzip content-length:16660 content-type:application/octet-stream
The content-length will in this case be the zipped length
If you want control of exactly how the GetVMFile URL is formed, look at The ExternalId explained