aspnet-js-aspxclientuploadcontrol-e1af27f3.md
Occurs on the client after upload of all selected files has been completed.
FilesUploadComplete: ASPxClientEvent<ASPxClientUploadControlFilesUploadCompleteEventHandler<ASPxClientUploadControl>>
The FilesUploadComplete event's data class is ASPxClientUploadControlFilesUploadCompleteEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| callbackData | Gets a string that contains specific information (if any) passed from the server side for further client processing. |
| errorText | Gets the error text to be displayed within the upload control’s error frame. |
Write the FilesUploadComplete event handler to perform specific client actions after all selected files have been uploaded to a server.
The FilesUploadComplete event is generated after the ASPxClientUploadControl.FileUploadComplete events related to all uploaded files have been fired.
A full example is available at the ASPxUploadControl - Upload and Submit online demo.
<dx:ASPxUploadControl runat="server" ID="DocumentsUploadControl" ClientInstanceName="DocumentsUploadControl" ...>
<AdvancedModeSettings EnableMultiSelect="true" EnableDragAndDrop="true" ExternalDropZoneID="dropZone" />
<ValidationSettings
AllowedFileExtensions=".rtf, .pdf, .doc, .docx, .odt, .txt, .xls, .xlsx, .ods, .ppt, .pptx, .odp, .jpe, .jpeg, .jpg, .gif, .png"
MaxFileSize="4194304">
</ValidationSettings>
<ClientSideEvents
FileUploadComplete="onFileUploadComplete"
FilesUploadComplete="onFilesUploadComplete"
FilesUploadStart="onFileUploadStart" />
...
</dx:ASPxUploadControl>
function onFileUploadComplete(s, e) {
var callbackData = e.callbackData.split("|"),
uploadedFileName = callbackData[0],
isSubmissionExpired = callbackData[1] === "True";
uploadedFiles.push(uploadedFileName);
if(e.errorText.length > 0 || !e.isValid)
uploadErrorOccurred = true;
if(isSubmissionExpired && UploadedFilesTokenBox.GetText().length > 0) {
var removedAfterTimeoutFiles = UploadedFilesTokenBox.GetTokenCollection().join("\n");
alert("The following files have been removed from the server due to the defined 5 minute timeout: \n\n" + removedAfterTimeoutFiles);
UploadedFilesTokenBox.ClearTokenCollection();
}
}
function onFilesUploadComplete(s, e) {
uploadInProgress = false;
for(var i = 0; i < uploadedFiles.length; i++)
UploadedFilesTokenBox.AddToken(uploadedFiles[i]);
updateTokenBoxVisibility();
uploadedFiles = [];
if(submitInitiated) {
SubmitButton.SetEnabled(true);
SubmitButton.DoClick();
}
}
function onFileUploadStart(s, e) {
uploadInProgress = true;
uploadErrorOccurred = false;
UploadedFilesTokenBox.SetIsValid(true);
}
See Also