BlobDownloadLink
No edit summary
No edit summary
Line 1: Line 1:
===== How to use =====
===== How to Use It =====
When you tag a ViewModelColumn with BlobDownloadLink = true - the UI will render this as a download link.
When you tag a ViewModelColumn with BlobDownloadLink = true - the UI will render this as a download link.


===== File content =====
===== File Content =====
It will use a call to GetVMFile on the turnkey server to allow for a download of content type application/octet-stream.
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.  
If your request has '''accept-encoding:gzip''' set - then we will gzip the file on the server before sending it back.  


===== Content type =====
===== 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/).  
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 =====
===== File Name =====
The ViewModelColumn that was tagged with BlobDownloadLink may be accompanied by a '''FileName''' column. '''Note!''' '''Case sensitive.'''  
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.
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 an 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.
Note that the filename is set during upload so this column needs to exist in the upload ViewModel.


===== Response headers =====
===== Response Headers =====
The server will tag the response header like this when downloading like this;
The server will tag the response header when downloading like this:
  content-encoding:gzip
  content-encoding:gzip
  content-length:16660
  content-length:16660
  content-type:application/octet-stream
  content-type:application/octet-stream
The content-length will in this case be the zipped length
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]].
[[Category:Tagged Values]]
[[Category:Tagged Values]]

Revision as of 06:33, 22 March 2023

How to Use It

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 an attachment with a set file name.

Note that the filename is set during upload so this column needs to exist in the upload ViewModel.

Response Headers

The server will tag the response header 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.

This page was edited 44 days ago on 03/26/2024. What links here