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

How to save image into database

5 Answers 272 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Ravi Kumar
Top achievements
Rank 1
Ravi Kumar asked on 09 Jul 2010, 12:58 PM
Hi,

How to save image into database on button click using RadAysncUpload control.

Please Help!

Regards
Ravi

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 14 Jul 2010, 09:18 AM
Hi Ravi Kumar,

Please check our new online example which demonstrates this functionality.

Greetings,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anahi
Top achievements
Rank 1
answered on 18 Feb 2011, 07:15 PM
Hi! i have a question...

As I can add the event Asyncupload _Fileupload in the event of the button? and save into database with others Radtextbox


=)
0
Dimitar Terziev
Telerik team
answered on 23 Feb 2011, 05:00 PM
Hi Ravi,

I'm not quite sure what you mean by "add the event Asyncupload _Fileupload in the event of the button".
This event is fired for every uploaded file , which is about to be saved in the Target Folder, and in order to fire this event a post-back should occur. In the demo , which my colleague has pointed you to, there is no Target Folder , but the file is directly saved into database by extending the Handler and providing custom implementation. In general you could save your image along with other data using OnFileUploaded event , without implementing the case from the demo. You just subscribe on the above mention server event, and when you click a button which cause a post-back this event will be fired.  When the event is fired you should get reference to the uploaded file:
protected void OnFileUploaded(object sender, FileUploadedEventArgs args)
 {
     UploadedFile file = args.File;
 }

and then you could save it manually to the desired database. In this event you could also get reference to other controls like RadTextBox , but be aware that this event is fired for every file uploaded. So if you allow multiple file uploading you may end with data duplication, if you save data from other controls each time
event is fired.

I hope this would help you.


Best wishes,
Dimitar Terziev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Navnit
Top achievements
Rank 2
answered on 10 Mar 2011, 04:55 PM
Hi Telerik,

How do you actually save files to the database when the OnClientFileUploaded() event is fired. I am fully aware of the OnFileUploaded() server-side event but I actually do not want to use it because I am also plugging a RadProgressArea along with it. Eventually, this results in the RadProgressArea to be shown twice (1st time while adding the files to the RadAsyncUpload control and the 2nd time when the upload button is actually clicked). 

Basically, what I want to achieve is to save the files directly to the database and showing the RadProgressArea while getting rid of the Upload Button.

Cheers
0
Dimitar Terziev
Telerik team
answered on 14 Mar 2011, 05:00 PM
Hi Navnit,

If you don't want to have a button, which triggers a post-back, you should check the online example, my colleague Yana has suggested before. Just in case you have missed it, you could check it here, along with this help article here.

Basically you should extend the RadAsynUpload handler to provide your custom functionality as described and shown in the demo.

Greetings,
Dimitar Terziev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
AsyncUpload
Asked by
Ravi Kumar
Top achievements
Rank 1
Answers by
Yana
Telerik team
Anahi
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Navnit
Top achievements
Rank 2
Share this question
or