Tab

FileSavingEventArgs.OutputStream Property

Set this property to change the original file content.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v21.1.dll

Declaration

public Stream OutputStream { get; set; }

Property Value

Type Description
Stream

A Stream object to which the modified file stream is sent.

Remarks

ASPxHtmlEditor allows you to edit (modify, check etc.) a file before saving it to the server. You can obtain an uploaded file using the FileUploadCompleteEventArgs.UploadedFile.FileContent property, perform actions on the stream, and send it to the server by setting the OutputStream property. Note that initially, the OutputStream property value is null.

NOTE

The file content provided by the OutputStream property shouldn’t be disposed.

Example

The example below demonstrates how you can use the ASPxHtmlEditor.ImageFileSaving server-side event to add a watermark to the uploaded image files.

protected void ASPxHtmlEditor1_FileDownloading(object source, DevExpress.Web.FileSavingEventArgs e) {
    using(Stream fileContent = e.UploadedFile.FileContent)
        e.OutputStream = AddWatermarkToImage(fileContent);        
}
See Also