Edit this page

Adding Files Programmatically

RadCloudUpload allows you to prepare files for upload in code using the AddFile method of the control. The method will create a new CloudUploadFile object and add it in the Items collection of the RadCloudUpload component, after a validation is performed.

The file object will also be included in the InvalidItems or ValidItems collection, depending on the validation result.

The AddFile method expects a file stream with the file that will be uploaded, along with a file name to indicate the name of the file to be saved. In addition, you can control whether the stream should be automatically closed after the upload finishes or not by passing true as the last parameter of the method (autoCloseStream).

[C#] Example 1: Add a file using the RadCloudUpload AddFile method

this.cloudUpload.AddFile(theNameOfTheFileToBeAdded, fileStream, true);

[VB.NET] Example 1: Add a file using the RadCloudUpload AddFile method

Me.cloudUpload.AddFile(theNameOfTheFileToBeAdded, fileStream, True);

See Also