ASP.NET 3.5 and above only

Obout.Ajax.UI Controls - File Upload - Server side

Obout.Ajax.UI.FileUpload.FileUpload class

 Inheritance Hierarchy

<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.FileUpload" TagPrefix="obout" %>

Properties

Name Description
propertyAccept String. Gets or sets a set of comma-separated strings, each of which is a valid MIME type that the server is able to accept. This property has effect only for the browsers that supports HTML5.
See the accept attribute's description here.

Example: Accept="image/*"

Default String.Empty .
propertyButtonCenterImage String. Gets or sets the relative URL of the image used as the repeated center part of the 'Browse' button's background.
Default String.Empty - Embedded image is used.
propertyButtonLeftImage String. Gets or sets the relative URL of the image used as the left part of the 'Browse' button's background.
Default String.Empty - Embedded image is used.
propertyButtonRightImage String. Gets or sets the relative URL of the image used as the right part of the 'Browse' button's background.
Default String.Empty - Embedded image is used.
propertyButtonTextColor Color. Gets or sets the 'Browse' button's text color.

Default System.Drawing.Color.White .
propertyBrowseFieldDescription String. Gets or sets the description used in files browser. This property has effect only for the browsers that doesn't supports HTML5 and so Adobe Flash is used.
Default String.Empty .

See online example.
propertyClearListImage String. Gets or sets the relative URL of the image used as 'Clear files list' button.
Default String.Empty - Embedded image is used.

Example: InProgressImage="~/Images/MyRemoveImage.gif"
propertyClientID String. Gets the server control identifier generated by ASP.NET. (Inherited from Control.)
propertyCssClass String. Gets or sets the Cascading Style Sheet (CSS) class rendered by the Web server control on the client. (Inherited from WebControl.)
Default "obout_ajax__fileupload".
propertyFeedbackMode Obout.Ajax.UI.FileUpload.FeedbackMode. Gets or sets feedback method used by the control for the files upload and 'Browse' button generation.

Obout.Ajax.UI.FileUpload.FeedbackMode enum contains the following fields:
  • Page - feedback is formed by the control on the Page initialization.
  • HttpHandler - feedback is formed by the Http handler, see the HttpHandlerUrl property.
    This feedback method is usefull when the control is placed inside repeaters, views, templates of the Grid, etc.

Default Obout.Ajax.UI.FileUpload.FeedbackMode.Page .
propertyForceSsl Bool. Gets or sets a value indicating whether to force use of SSL for inner resources. This property is useful when a proxy server such as Apache is used to service HTTPS requests and request HTTP pages from IIS.

Default false.
propertyHttpHandlerUrl String. Gets or sets the Url of .ASHX file used for feedback when the FeedbackMode property is set to HttpHandler.

Default "FileUploadHandler.ashx".
propertyID String. Gets or sets the programmatic identifier assigned to the server control. (Inherited from Control.)
propertyInfoImage String. Gets or sets the relative URL of the image used as 'Information' button.
Default String.Empty - Embedded image is used.

Example: InProgressImage="~/Images/MyInfoImage.gif"
propertyInProgressImage String. Gets or sets the relative URL of the 'In Progress' image used for a file that is still uploading.
Default String.Empty - Embedded image is used.

Example: InProgressImage="~/Images/MyProgressImage.gif"
propertyMaximumFileSize Int. Gets or sets the maximum size (in kB) of the file for uploading.
Default 0 - any size is allowed.

See online example.
propertyMaximumTotalFileSize Int. Gets or sets the maximum total size (in kB) of files for uploading.
Default 0 - any size is allowed.

See online example.
propertyOnClientBeforeUpload String. Gets or sets the name of client-side function(handler) executed just before files transfer started.
This handler is added to the client-side event beforeUpload, see Client-Side.
propertyOnClientFilesPicked String. Gets or sets the name of client-side function(handler) executed when files where selected from the files browser.
This handler is added to the client-side event filesPicked, see Client-Side.
propertyOnClientAfterServerResponse String. Gets or sets the name of client-side function(handler) executed when the server acknowledges receipt of all files.
This handler is added to the client-side event afterServerResponse, see Client-Side.
propertyOnClientTransferFinished String. Gets or sets the name of client-side function(handler) executed when all files have been transfered.
This handler is added to the client-side event transferFinished, see Client-Side.
propertyPostedFiles Collection<PostedFileInfo>. Gets a collection of uploaded files descriptors (on postback).

Example:

protected void Page_Load(object sender, EventArgs e)
{
  if (Page.IsPostBack)
  {
     string result = "";
     foreach (PostedFileInfo info in fileUpload1.PostedFiles)
     {
        result += " Name: " + info.FileName
                 + " Length: " + info.ContentLength
                 + " Content type: " + info.ContentType + "<br>";
     }
     if (result.Length == 0)
     {
        result = "No files uploaded";
     }
     label.Text = result;
  }
}
propertyRelativeImageUrl Bool. Gets or sets a value indicating whether to use realtive URL for the 'Browse' button image.

Default false.
propertyStyleFile String. Gets or sets a style file path.
Default String.Empty - Embedded style file is used.

Example: StyleFile="~/GlobalStyles/MyFileUpload.css"
propertyTempFolderPath String. Gets or sets the relative URL of a folder used for temporary files holding.
Default String.Empty - System folder is used.

Example: TempFolderPath="~/temp"
propertyUniqueID String. Gets the unique, hierarchically qualified identifier for the server control. (Inherited from Control.)
propertyUploadFinishedImage String. Gets or sets the relative URL of the 'Upload Finished' image used for files that are uploaded already.
Default String.Empty - Embedded image is used.

Example: InProgressImage="~/Images/MyUploadedImage.gif"
propertyUploadFolder String. Gets or sets the relative URL of the folder for upload.
If you specify this folder, then uploaded files will be saved there automatically (you don't need to do it in your code behind).

Default String.Empty - Uploaded files will not be saved automatically.
propertyValidFileExtensions String. Gets or sets valid extensions of files (separated with ';').
Default String.Empty (all files are allowed).

See online example.
propertyWidth Unit. Gets or sets the width of the popup (can be set in pixels only here). (Inherited from WebControl.)
Default Unit.Pixel(250).

Events

Name Description
propertyBeforeFileSave BeforeFileSaveEventHandler. This event is fired before each of the downloaded files will be saved to disk when the UploadFolder is specified.

Event's argument has type BeforeFileSaveEventArgs.

Code sample:

ASPX

<obout:FileUpload ID="fileUpload" UploadFolder="~/UploadedImages" OnBeforeFileSave="BeforeFileSave" … />

Code behind

protected void BeforeFileSave(object sender, BeforeFileSaveEventArgs e)
{
  // cancel if a file with this name exists already in the folder
  if (File.Exists(Path.Combine(e.AbsFolderPath, e.FileName)))
  {
       e.Cancel = true;
  }
}

"Since the birth of ASP.NET I have tried several components, but your product is unquestionably the best collection of ASP.NET controls. Absolutely great products!"

Viggo Barbala
Norway

Random testimonial   All testimonials