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

ASPxUploadControl.FileInputCount Property

Gets or sets the number of file input elements contained within an ASPxUploadControl.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(1)]
public int FileInputCount { get; set; }

Property Value

Type Default Description
Int32 1

An integer value that represents the total number of file input elements.

Remarks

The File Input Element counts can be changed by an end-user on the client side by using the add and the remove buttons. In this case, the ASPxUploadControl.FileInputCount property value is synchronized with actual number of file input elements after the most recent postback on the server.

<dx:ASPxUploadControl ID="ASPxUploadControl1" runat="server" FileInputCount="5" >
  ...
</dx:ASPxUploadControl>

The UploadedFile object is generated for each of the uploaded files. You can use the ASPxUploadControl.UploadedFiles property to get access to these objects. An individual UploadedFile object can be accessed via its index, which is associated with the visual index of corresponding file input elements within the ASPxUploadControl (note that the file input elements indexes represent a zero-based array).

Handle the ASPxClientUploadControl.FileInputCountChanged event to perform specific actions on the client side each time after the file input elements count is changed.

Example

The following part of the ASPxUploadControl Multi-File Upload online demo illustrates the ASPxUploadControl’s capability to upload more than one file at a time.

var fieldSeparator = "|";
function FileUploadStart() {
    document.getElementById("uploadedListFiles").innerHTML = "";
}
function FileUploaded(s, e) {
    if(e.isValid) {
        var linkFile = document.createElement("a");
        var indexSeparator = e.callbackData.indexOf(fieldSeparator);
        var fileName = e.callbackData.substring(0, indexSeparator);
        var pictureUrl = e.callbackData.substring(indexSeparator + fieldSeparator.length);
        var date = new Date();
        var imgSrc = "UploadImages/" + pictureUrl + "?dx=" + date.getTime();
        linkFile.innerHTML = fileName;
        linkFile.setAttribute("href", imgSrc);
        linkFile.setAttribute("target", "_blank");
        var container = document.getElementById("uploadedListFiles");
        container.appendChild(linkFile);
        container.appendChild(document.createElement("br"));
    }
}
See Also