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

Sample Code?

3 Answers 72 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 14 Jan 2013, 04:40 PM
Hello,

I just downloaded your trial version of the AJAX controls for .NET today.  We have an application that performs uploads of files along with saving associated user entered data for the file that was uploaded.  Previously we were using the SlickUpload control but this product has been sold and isn't supported anymore.

So, I'm looking at converting our application to use your AsyncUpload component.  Some things that I see that are different is that we upload the file on submit of the page along with the information that the user entered.  So, the process is something like: upload file and display upload progress bar when page is submitted and then after file is uploaded, in the same transaction, update the database with the information that the user entered about the file.

I saw that you have a few sample programs that combine some aspects of this but it would involve combining multiple demos to achieve what I'd like.  Usually you upload the file automatically in the client code when the file is selected vs having it uploaded it on submit of the page.  Also I couldn't find a good example of uploading the file and then saving associated database information immediately after the upload takes place.  I would need to write a custom HTTP handler for this?  Do you have some sample code for this?

Thanks for your help in pointing me in the right direction.

Mike Nelson

3 Answers, 1 is accepted

Sort by
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 14 Jan 2013, 05:03 PM
Hi Michael,

It looks as though you want to save the uploaded files to your server without causing a post back on the page. You can start by getting familiar with the OnClientFileUploaded event. RadAsyncUpload stores the images in a temporary file before a post back has occurred. In the code behind you can access these files and save them to your server at the specified event. You can learn more about all available events on the online documentation.

Hope I could be of some help,
Bart
0
Michael
Top achievements
Rank 1
answered on 15 Jan 2013, 03:29 PM
Dear Bart,

Actually I'd like to have the file upload on postback.  So have the file selected without causing an upload of any temporary file and then upload the file and associated information fields when the form is submitted.

I tried this by setting the ManualUpdate property of the AsyncUpload control and it does call my custom handler when I submit the page but it doesn't call the FileUploaded event after this. 

I'm unclear if I should be saving the uploaded file and associated information (associated information is saved to the DB) in the custom handler or in the FileUploaded event?  Is there some action in the custom handler that should be executed in order for the FileUploaded server side event to occur?

Thanks for your help,

Mike Nelson
0
Plamen
Telerik team
answered on 17 Jan 2013, 02:41 PM
Hello Mike,

 
FileUploaded server event is thrown only after postback is initialized- you can also trigger it in the OnClientFilesUploaded.

Hope this information will be helpful. 

Kind regards,
Plamen
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
Michael
Top achievements
Rank 1
Answers by
MasterChiefMasterChef
Top achievements
Rank 2
Michael
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or