Completed
Last Updated: 09 Jun 2016 15:25 by ADMIN
ADMIN
Marin Bratanov
Created on: 21 Aug 2014 13:58
Category: FileExplorer
Type: Feature Request
4
IMPROVE RadFileExplorer file upload validation error message to indicate clearly what is the error
At present, when an invalid file is selected, the alert message does not clearly indicate what is the validation error - invalid extension or the size being too large. It should show a message that clearly states what the problem is so the user can fix it.


For the time being you can handle the AsyncUpload's OnClientValidationFailed event and show different messages—http://docs.telerik.com/devtools/aspnet-ajax/controls/asyncupload/client-side-programming/onclientvalidationfailed.

Example:

ASP.NET
-------------------------------
<telerik:RadFileExplorer runat="server" ID="RadFileExplorer1">
    <Configuration ViewPaths="~/" UploadPaths="~/" DeletePaths="~/" SearchPatterns="*.jpg" />
</telerik:RadFileExplorer>

<script>
    // Prevent the built-in validation alert
    Telerik.Web.UI.RadFileExplorer.prototype._showUploadValidationFailedAlert = function () {

    }

    function OnClientValidationFailed(sender, args) {
        var fileExtention = args.get_fileName().substring(args.get_fileName().lastIndexOf('.') + 1, args.get_fileName().length);
        if (args.get_fileName().lastIndexOf('.') != -1) {//this checks if the extension is correct
            if (sender.get_allowedFileExtensions().indexOf(fileExtention) == -1) {
                alert("Wrong Extension!");
            }
            else {
                alert("Wrong file size!");
            }
        }
        else {
            alert("not correct extension!");
        }
    }
</script>
-------------------------------

C#
-------------------------------
RadFileExplorer1.AsyncUpload.OnClientValidationFailed = "OnClientValidationFailed";
-------------------------------

VB
-------------------------------
RadFileExplorer1.AsyncUpload.OnClientValidationFailed = "OnClientValidationFailed"
-------------------------------

3 comments
ADMIN
Rumen
Posted on: 09 Jun 2016 15:24
I switched the item status to completed, because:
- there is a provided solution by Telerik
- the demand for built-in implementation isn't enough
ADMIN
Ianko
Posted on: 26 May 2016 08:46
Item's content is updated with a possible workaround. 
Keiko
Posted on: 25 May 2016 13:52
Hi, I totally agree.  Anyone has a workaround?