Skip to main content
A newer version of this page is available. .

ASPxBinaryImage

  • 2 minutes to read

The ASPxBinaryImage control is an editor capable of displaying images from a binary stream.

ASPxBinaryImage

The ASPxBinaryImage.ContentBytes property provides access to editor contents represented by an array of bytes. The ASPxBinaryImage.StoreContentBytesInViewState property allows you to control whether or not editor content is stored within the editor’s view state between postbacks.

Tip

The ASPxBinaryImage control supports the IIS clustered web environment (also known as Web Farms or Web Gardens). To learn more, see the Binary Storage Configuration topic.

Image Uploading

When the BinaryImageEditingSettings.Enabled property is set to true, end users can upload an image to the control by using the open dialog button.

ASPxBinaryImage_overview

When the drag and drop feature is enabled (the BinaryImageEditingSettings.AllowDropOnPreview property is set to true), end users can upload an image by dropping it to the image area.

BinaryImage_DragAndDrop

The following code sample demonstrates how to save an uploaded image’s bytes on the server side.

protected void ASPxButton1_Click(object sender, EventArgs e) {
    string fileName = Server.MapPath("~/App_Data/UploadedData/avatar.jpg");
    File.WriteAllBytes(fileName, ASPxBinaryImage1.ContentBytes);
}

Supported Image File Formats

ASPxBinaryImage supports the following image file formats:

  • TIFF (Tagged Image File Format)
  • PNG (Portable Network Graphics)
  • GIF (Graphics Interchange Format)
  • JPEG (Joint Photographic Experts Group)
  • BMP (Windows Bitmap)

Note

Use the ASPxImage control to use the URL path to show an image from the server side.