Use TargetPhysicalFolder

This article shows how to use the TargetPhysicalFolder property of RadUpload.

The property is exposed on both the RadUpload control and RadUploadHandler and it allows setting a physical path on the server where the file should be uploaded. RadUpload sends its TargetPhysicalFolder value to the RadUploadHandler's property and this is used as a storage location.

In version 2020.1.413 and later of Telerik UI for Silverlight, the TargetPhysicalFolder is send to RadUploadHandler, but it no longer reads it from the web request. After this version the property is not used by the handler due to security reasons.

To enable reading the TargetPhysicalFolder from the web request in the handler, override its Initialize method and set the TargetPhysicalFolder property using the GetQueryParameter method.

Example 1: Setting up the RadUpload control

<telerik:RadUpload UploadServiceUrl="/SampleUploadHandler.ashx" TargetPhysicalFolder="C:\UserData\Uploads"/> 

Example 2: Setting TargetPhysicalFolder in the handler

public class SampleUploadHandler : RadUploadHandler 
    public override void Initialize() 
        this.TargetPhysicalFolder = this.GetQueryParameter(RadUploadConstants.ParamNameTargetPhysicalFolder);             

If both TargetPhysicalFolder and TargetFolder are set, the TargetPhysicalFolder will take precedence.

See Also

In this article