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

Execute Code after selection of multiple files.

3 Answers 88 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Roger asked on 20 Sep 2019, 08:04 PM

I would like to take files selected, and automatically "Upload" them to my site without having to see the list of files or use another button?

 

Is this possible?

 

Thanks

 

Rog

3 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 25 Sep 2019, 11:31 AM

Hello Rog,

The AsyncUpload starts uploading the files automatically to the Temporary folder unless the Manual upload is activated. Then, the postback is used to allow the code behind to have access to the files and move the files from the Temporary folder to the Target folder. 

With that said, you can use the OnClientFilesUploaded event, that is fired after all the files are uploaded, and trigger the postback programmatically.

Regarding the list of files, you can hide the with CSS:

.RadAsyncUpload ul{
    display:none;
}

Regards,
Peter Milchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Roger
Top achievements
Rank 2
Iron
Iron
Iron
answered on 25 Sep 2019, 01:04 PM

Pete,

Thanks for the response.  I do however have one question.

 

When looking at the "Events" in the Design View of the AsyncUpload control I only list the following events:

 

DataBinding

Disposed

FileUploaded

Init

Load

Prerender

Unload

 

When trying to use the OnClientFilesUploaded event I am getting an error stating

JavaScript runtime error: 'OnClientFilesUploaded' is undefined

Not sure why?   I am using telerik version 2019 Q2

 

Thanks,

 

Roger 

0
Accepted
Peter Milchev
Telerik team
answered on 30 Sep 2019, 07:24 AM

Hello Roger,

The events you have listed below are the available Server-side events of the AsyncUpload, while the the OnClientFilesUploaded event is a Client-side event. 

The error that you observe is most probably caused by the fact that the control cannot find a globally accessible function named "OnClientFilesUploaded".

<script>
    function OnClientFilesUploadedHandler(sender, args) {

    }
</script>
<telerik:RadAsyncUpload runat="server" MultipleFileSelection="Automatic" OnClientFilesUploaded="OnClientFilesUploadedHandler"></telerik:RadAsyncUpload>

Regards,
Peter Milchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
AsyncUpload
Asked by
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Peter Milchev
Telerik team
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or