Unplanned
Last Updated: 17 Oct 2016 08:02 by ADMIN
ADMIN
Dimitar
Created on: 17 Oct 2016 07:22
Category: AsyncUpload
Type: Bug Report
0
JS error on dropping a file over a custom drop zone, when RadAsyncUpload's MaxFileInputsCount has already been reached
Workaround - Toggle drop zone visibility or enable/disable it, using AsyncUpload OnClientFileUploaded and OnClientFileUploadRemoved events:

<div class="dropfile" style="height: 20px; width: 120px; background-color: red; display: block">
</div>
<telerik:RadAsyncUpload ID="fimFileImport" runat="server" DropZones=".dropfile" MaxFileInputsCount="1"
	RenderMode="Lightweight" OnClientFileUploaded="OnClientFileUploaded" OnClientFileUploadRemoved="OnClientFileUploadRemoved" >
</telerik:RadAsyncUpload>

<script type="text/javascript">
	function OnClientFileUploaded(sender, args) {

		var maxFileCount = sender.get_maxFileCount();
		var uploadedFilesLength = sender.getUploadedFiles().length;
		
		if (maxFileCount === uploadedFilesLength) {
			$telerik.$('.dropfile').hide();
		}
	}

	function OnClientFileUploadRemoved(sender, args) {

		var maxFileCount = sender.get_maxFileCount();
		var uploadedFilesLength = sender.getUploadedFiles().length;

		if (maxFileCount > uploadedFilesLength) {
			$telerik.$('.dropfile').show();
		}
	}
</script>
0 comments