🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Using BlobDownloadLink
This page was created by Wikiadmin on 2026-07-29. Last edited by Wikiadmin on 2026-07-29.

You can configure a Blob column in a ViewModel to render as a download link in MDriven Turnkey, with an optional file name and MIME content type for each downloaded file.

What BlobDownloadLink does

BlobDownloadLink is a Turnkey Web-UI tagged value that you set on a ViewModel column containing Blob data. When Turnkey renders that column, it creates a hyperlink that downloads the Blob rather than rendering the Blob content.

Use this when a user should download a stored file such as a PDF, spreadsheet, or document.

Configure a Blob download link

  1. In MDriven Designer, add a Blob attribute to the class that stores the file.
  2. Add the Blob attribute to the relevant ViewModel.
  3. Select the ViewModel column that contains the Blob and set it to isStatic. A Blob download column must be static for Turnkey download handling.
  4. Add the BlobDownloadLink tagged value to that same ViewModel column.
  5. Add the optional companion columns described below at the same ViewModel nesting as the Blob column.
  6. Upload or otherwise populate the Blob data, then open the ViewModel in Turnkey. The tagged Blob column renders as a download link.

For uploading Blob data and the general file and image setup, see HowTos:Upload and Download Files and Images in MDriven Turnkey.

Add a file name

To make the browser download the Blob as an attachment with a specific name, add a String ViewModel column whose name is based on the Blob column name:

<BlobColumnName>_FileName

The name is case-sensitive. The file-name column must exist at the same ViewModel nesting as the Blob column. It does not have to be visible in the user interface, but it must be present in the ViewModel.

Example

If the Blob ViewModel column is named MyColumn, add this String column alongside it:

MyColumn_FileName

When MyColumn_FileName contains quarterly-report.pdf, Turnkey marks the download response as an attachment with that file name.

When files are uploaded through a ViewModel, ensure that this column exists in the uploaded ViewModel so the uploaded file name can be stored. Turnkey uses the corresponding _FileName column for this purpose.

Add a content type

To return the correct MIME content type, add a String ViewModel column named:

<BlobColumnName>_ContentType

This column also must be at the same ViewModel nesting as the Blob column. It can be hidden from the UI, but it must exist in the ViewModel.

Example

For the MyColumn Blob column, add:

MyColumn_ContentType

Set its value to a valid web MIME type, for example:

Downloaded file Value in MyColumn_ContentType
PDF document application/pdf
Microsoft Excel workbook application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Plain text file text/plain

If no matching _ContentType column is available, the download uses application/octet-stream.

Complete naming example

The following three columns are siblings in one ViewModel nesting. Only Document needs to be presented as the download link.

ViewModel column Type Purpose
Document Blob The file data. Set isStatic and add the BlobDownloadLink tagged value.
Document_FileName String Optional download file name, for example invoice-1042.pdf.
Document_ContentType String Optional MIME type, for example application/pdf.

Do not rename either companion column to a different casing or place it at another nesting level. For example, document_FileName does not match Document because the convention is case-sensitive.

Download request behavior

Turnkey serves the file through GetVMFile. With a matching content-type column, that value is used for the response content-type; otherwise, the response uses application/octet-stream.

If the request contains accept-encoding: gzip, the server compresses the file before sending it. In that case, response headers can include:

content-encoding: gzip
content-length: 16660
content-type: application/octet-stream

The content-length is the compressed length when gzip is used.

Control the download URL

If you need to control how the GetVMFile URL is formed, use the guidance in The ExternalId explained.

Troubleshooting

Symptom Check
The Blob does not render as a download link. Confirm that the Blob ViewModel column is static and has the BlobDownloadLink tagged value.
The downloaded file has no expected name. Add or verify the same-level String column named exactly <BlobColumnName>_FileName. For uploaded files, ensure that this column is included in the uploaded ViewModel.
The browser treats the file as an unknown binary file. Add or verify the same-level String column named exactly <BlobColumnName>_ContentType and populate it with the appropriate MIME type.
The companion column is present but is not found. Check the exact casing and ensure that it is at the same ViewModel nesting as the tagged Blob column.

See also