Hello -
I'm using the the RadAsyncUpload and i've wired up a client side handler to the OnClientFileSelected event. My goal is to alert the user that their file is not a valid extension and then reset the control by removing the file that they attempted to upload. According to your documentation here I should be able to make use of the remove_fileSelected method to remove the file that the user attempted to upload and thus hopefully reset the control so the user can do a new upload.
The problem I have is I can't find any documentation on your site for what the signature is for remove_fileSelected or how it should be used - what parameter needs to be passed to it. Here is my handler code, please help, and if possible please expound your documentation so this is more clear.
Thanks.
I'm using the the RadAsyncUpload and i've wired up a client side handler to the OnClientFileSelected event. My goal is to alert the user that their file is not a valid extension and then reset the control by removing the file that they attempted to upload. According to your documentation here I should be able to make use of the remove_fileSelected method to remove the file that the user attempted to upload and thus hopefully reset the control so the user can do a new upload.
The problem I have is I can't find any documentation on your site for what the signature is for remove_fileSelected or how it should be used - what parameter needs to be passed to it. Here is my handler code, please help, and if possible please expound your documentation so this is more clear.
Thanks.
this
.checkFileExtension =
function
(radUpload, args) {
if
(!radUpload.isExtensionValid(args.get_fileName())) {
alert(
'Please upload images with .jpg, .gif, .png, .bmp, or .tif extensions.'
);
radUpload.remove_fileSelected();
}
}
10 Answers, 1 is accepted
0
Hi Ian,
The remove_fileSelected method removes the event handler of the OnClientFileSelected event. The following sample code implements your scenario:
Regards,
Peter Filipov
the Telerik team
The remove_fileSelected method removes the event handler of the OnClientFileSelected event. The following sample code implements your scenario:
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"RadScriptManager"
>
</
telerik:RadScriptManager
>
<
telerik:RadAsyncUpload
ID
=
"RadAsyncUpload1"
runat
=
"server"
ViewStateMode
=
"Enabled"
AllowedFileExtensions
=
".png"
OnClientValidationFailed
=
"onClientValidationFailed"
>
</
telerik:RadAsyncUpload
>
</
div
>
</
form
>
<
script
type
=
"text/javascript"
>
function onClientValidationFailed(sender, args) {
$telerik.$(".ruCancel").parent().remove();
alert("Allowed files extension is png");
}
</
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
0

Ian
Top achievements
Rank 1
answered on 19 Nov 2011, 12:40 AM
This doesn't work. It just removes the whole control (probably because I have max file inputs set to 1), I still want the user to be able to select a different file after they've attempted upload of an invalid file. Please advise, thanks.
0
Hello Ian,
The RadAsyncUpload disappears because the
Best wishes,
Peter Filipov
the Telerik team
The RadAsyncUpload disappears because the
MaxFileInputsCount is set to 1. Please try the following sample code to avoid that behavior.<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:radscriptmanager
runat
=
"server"
id
=
"RadScriptManager"
>
</
telerik:radscriptmanager
>
<
telerik:radasyncupload
id
=
"RadAsyncUpload1"
runat
=
"server"
viewstatemode
=
"Enabled"
MaxFileInputsCount
=
"1"
allowedfileextensions
=
".png"
onclientvalidationfailed
=
"onClientValidationFailed"
>
</
telerik:radasyncupload
>
</
div
>
</
form
>
<
script
type
=
"text/javascript"
>
function onClientValidationFailed(sender, args) {
$telerik.$(".ruCancel").parent().remove();
alert("Allowed files extension is png");
sender.addFileInput();
}
</
script
>
Best wishes,
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

Ian
Top achievements
Rank 1
answered on 22 Nov 2011, 06:04 PM
This seems to work well, thanks.
On a side note I've used Telerik products for several years, I would sum up my experience with your controls like this: great controls with terrible documentation. Surely i'm not the only one to comment on this, is this is something Telerik could improve? I think it needs more concrete examples and descriptions for each public method and property that is available on each control.
On a side note I've used Telerik products for several years, I would sum up my experience with your controls like this: great controls with terrible documentation. Surely i'm not the only one to comment on this, is this is something Telerik could improve? I think it needs more concrete examples and descriptions for each public method and property that is available on each control.
0
Hi Ian,
Thank you for your feedback. We will do our best to update the documentation. Regarding the RadAsyncUpload documentation you can find here all the methods used in the example below.
All the best,
Peter Filipov
the Telerik team
Thank you for your feedback. We will do our best to update the documentation. Regarding the RadAsyncUpload documentation you can find here all the methods used in the example below.
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

Lobna
Top achievements
Rank 1
answered on 09 Jan 2013, 12:10 PM
when I try to upload file with RadAsyncUpload, it crashes when the file is open.
How to solve this?
Thanks
How to solve this?
Thanks
0
Hello Lobna,
We had similar issue which is resolved in the latest version of our controls. Do you reproduce the issue on our online demos?
Regards,
Peter Filipov
the Telerik team
We had similar issue which is resolved in the latest version of our controls. Do you reproduce the issue on our online demos?
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.
0

Lobna
Top achievements
Rank 1
answered on 14 Jan 2013, 01:52 PM
Thanks for your reply.
No, on online demos there is no such problem. So I think I need to update my Version.
I have v.2012.2.815.40, so I need to update it, right?
No, on online demos there is no such problem. So I think I need to update my Version.
I have v.2012.2.815.40, so I need to update it, right?
0
Hello Lobna,
Actually the issue is possible to come from the version of your Silverlight/Flash plugins. Before downloading the latest version of our controls you could try to set DisablePlugins property to true.
Regards,
Peter Filipov
the Telerik team
Actually the issue is possible to come from the version of your Silverlight/Flash plugins. Before downloading the latest version of our controls you could try to set DisablePlugins property to true.
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.
0

Lobna
Top achievements
Rank 1
answered on 19 Jan 2013, 07:22 AM
Hello Peter,
It works fine after changing the 'DisablePlugins' property to true.
Thanks alot,
It works fine after changing the 'DisablePlugins' property to true.
Thanks alot,