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

How to remove all links of invalid file after uploading

3 Answers 92 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jin
Top achievements
Rank 1
Jin asked on 16 Aug 2012, 08:22 AM
The allowed file type is txt. After I upload four word documents. how can I remove those four links and only show one alert message?

3 Answers, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 16 Aug 2012, 03:30 PM
Hello Zin,

Straight to the question. It is not possible to show only one alert message because the FileValidationFailed event is fire for every one of the invalid files. Please review the attached sample. It shows how to remove the invalid files.

All the best,
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
Vasssek
Top achievements
Rank 1
answered on 22 Aug 2012, 11:56 AM
Hello,

thanks for that example. I have declared in web.config maximal file size:
<httpRuntime maxRequestLength="10240"/>

Then I couldn't use OnClientValidationFailed client side method from your example, but instead of it I need to use OnClientFileUploadFailed event. But in this method, It seems that index is undefined there.
var index = $(args.get_row()).index();

Please help me to solve my issue, how to remove last uploaded file which has bigger size than it's defined in web.config.

Best regards

Vasssek
0
Vasssek
Top achievements
Rank 1
answered on 23 Aug 2012, 11:46 AM
Hello,

I've solved my issue via this code.
function ClientFileUploadFailed(sender, args) 
{
    args.set_handled(true);
    args.get_row().style.display = "none";
}

I hope, it helps somebody else :)

Vasssek
Tags
AsyncUpload
Asked by
Jin
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Vasssek
Top achievements
Rank 1
Share this question
or