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

[Solved] Rad Editor Upload Image

1 Answer 174 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Darryl Henderson
Top achievements
Rank 1
Darryl Henderson asked on 30 Jun 2009, 04:45 AM

Hi Support Team,

I am working on Rad Editor. In the image upload Area. Afterbrowsing the image I have to add below code inthe click event of upload button.

WebClient oclient = new WebClient();

byte[] responseArray = oclient.UploadFile(PageUrlofRemoteServer,"POST",UploadimagePathAlongwithFileName);

Reason :

 I have to upload thebrowse image to some other location (other domain like http://www.domain.com/images/imagefilename)

for that I wrote the above code which work fine.

But how can integrate this code with Rad Editor UploadButton Click event.

Regards

Ravindra Sahasrabudhe

(rs@mtccrm.com)

1 Answer, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 02 Jul 2009, 02:29 PM
Hi Ravindra,

You will need to write a custom content provider for the editor dialogs and override the StoreFile method, which is called each time a file is uploaded. You can add your custom code there. Since this is the only method you need to change, there is no need to write a completely new content provider - you can inherit the default FileSystemContentProvider class. For more information, consult the RadControls documentation:

http://www.telerik.com/help/aspnet-ajax/customfilebrowsercontentprovider.html
http://www.telerik.com/help/aspnet-ajax/radfileexplorer-custom-filebrowsercontentprovider.html (look at the secion "Subclassing existing FileSystemContentProvider")
Here is the method you need to override:

public override string StoreFile(UploadedFile file, string path, string name, params string[] arguments) 
    //your code here 
    return base.StoreFile(file, path, name, arguments); 

Note that you can set the new content provider only on the editor dialogs you need (e.g. image manager) and still use the default one on other dialogs (e.g. document manager).


Sincerely yours,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Upload (Obsolete)
Asked by
Darryl Henderson
Top achievements
Rank 1
Answers by
Lini
Telerik team
Share this question
or