File Upload

Alias: Umbraco.UploadField

Returns: string

Adds an upload field, which allows documents or images to be uploaded to Umbraco.

You can define which file types should be accepted through the upload field.

For uploading and adding files and images to your Umbraco project, we recommend using the Media Picker.

Find the full documentation for the property in the Media Picker article.

Data Type Definition Example

Data Type Definition Example

Content Example

Content Example Empty
Content Example

In code, the property is a string, which references the location of the file.

Example: "/media/o01axaqu/guidelines-on-remote-working.pdf"

MVC View Example

Without Modelsbuilder

With Modelsbuilder

Add values programmatically

The samples in this section have not been verified against the latest version of Umbraco.

Instead, we recommend using the Media Picker for uploading files to your Umbraco website.

See the example below to see how a value can be added or changed programmatically. To update a value of this property editor you need the Content Service and the Media Service.

The example below demonstrates how to add values programmatically using a Razor view. However, this is used for illustrative purposes only and is not the recommended method for production environments.

Although the use of a GUID is preferable, you can also use the numeric ID to get the page:

If Modelsbuilder is enabled you can get the alias of the desired property without using a magic string:

Last updated