This is a migrated thread and some comments may be shown as answers.

ClientFileUploadRemoving - How can you work out if someone is removing an invalid file

3 Answers 81 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Lachlan
Top achievements
Rank 1
Lachlan asked on 23 Jan 2013, 02:28 AM
I was trying to implement some nicer client side error handling informing the user why the upload failed as the exisiting client feedback is just a red dot instead of a green dot, so I followed this example 
http://demos.telerik.com/aspnet-ajax/asyncupload/examples/validation/defaultcs.aspx

But I am now trying to work out how to hide the error message when the user clicks remove on an invalid file.

I looked at OnClientFileUploadRemoving, but that only gets triggered if a valid file is removed.

Also, is there something similar to the upload.isExtensionValid method that checks if the file size is valid? 

Thanks

3 Answers, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 25 Jan 2013, 05:13 PM
Hello Lachlan,

Please review the following client side event.

Greetings,
Peter Filipov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Lachlan
Top achievements
Rank 1
answered on 25 Jan 2013, 09:09 PM
Hi Peter, 

Thanks for the reply.

I am already using the:
function OnClientValidationFailed(sender, args)
I use that to display the error message, and that is being triggered fine.

What i want to know is what event is fired when a user clicks Remove  on an invalid file. So when a user clicks remove on an invalid file I would like to remove the error message. It seems that when a valid file is removed the ClientFileUploadRemoving method is triggered, but not for invalid files.

Thanks

Lach
0
Peter Filipov
Telerik team
answered on 30 Jan 2013, 11:04 AM
Hello Lachlan,

Please try the following code and let me know if it helps.
<form id="form1" runat="server">
<div>
    <telerik:RadScriptManager runat="server" ID="RadScriptManager"></telerik:RadScriptManager>
    <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" AllowedFileExtensions=".jpg" OnClientFileUploadRemoving="onClientFileUploadRemoving"></telerik:RadAsyncUpload>
</div>
</form>
<script type="text/javascript">
    function onClientFileUploadRemoving(sender, args) {
        var row = args.get_row(),
            $ = $telerik.$,
            isValidFile = $(row).find(".ruUploadSuccess").length > 0;
 
        if (isValidFile)
            alert("You are removing Valid file");
        else
            alert("You are removing Invalid file");
    }
</script>

Regards,
Peter Filipov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
AsyncUpload
Asked by
Lachlan
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Lachlan
Top achievements
Rank 1
Share this question
or