Using local images with RadEditor

6 posts, 0 answers
  1. Brad McBride
    Brad McBride avatar
    10 posts
    Member since:
    Feb 2010

    Posted 24 Sep 2010 Link to this post

    I am creating an HTML editor using the RadEditor and I am running into an issue. I cannot upload files to the server that the control will be run on. Instead, when a user needs to add an image to an HTML page, they will need to reference a local file, i.e., <img src="file://c:/some_path/some_image.jpg />. Is there any way at all to use the image manager to look at files on the local computer and insert a reference to the local file instead of something on the remote server? If not, is there another way to easily do this?
  2. Rumen
    Admin
    Rumen avatar
    14028 posts

    Posted 27 Sep 2010 Link to this post

    Hi Brad,

    When copying an image from external location such as your hard disk or desktop program as MS Word document or a PDF file, then the image src points to your hard disk, which is not accessible in Internet and the other network / internet users will be unable to see it.

    In order to use images in a web page, they need to be accessible using HTTP protocol - that is, it means they must be uploaded to a web server (which can be your own computer of course, only that the images are provided by the web server software, and not by the operating system).

    Unfortunately the automatic image upload to the server is not possible with JavaScript code, because JavaScript cannot access the local file system from the browser - it would be a major security violation.

    The automatic image upload cannot be implemented without using ActiveX or another software, installed on the client. We do not use either technique because of browser compatibility and that the ActiveX components are forbidden by the corporate networks.

    Best regards,
    Rumen
    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
  3. pavan
    pavan avatar
    17 posts
    Member since:
    Aug 2010

    Posted 26 Sep 2011 Link to this post

    So how to acheive this.Whether we have to upload that images to some server (through code)which is accessible to internet and then while showing we have to get it from the same server.or any other way?.What if we want to copy some images or graphics from local machine and then paste in radeditor(not browsing).Is this possible?
  4. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 26 Sep 2011 Link to this post

    Hi Pavan,

    As Rumen already explained, automatic upload of files cannot be achieve using JavaScript. Nevertheless, RadEditor's ImageManager offers upload functionality. If you do not have permissions to upload files to the server where the page resides you can assign a custom FTP content provider to the dialog to allow it to operate with a different FTP server where your users will have permissions to upload files. You can find an example of how to assign custom content provider to the ImageManager in the following live demo:
    Editor / Custom File Dialogs Content Provider

    Also, an example of FTPContentProvider is available in this KB article.

    Greetings,
    Dobromir
    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
  5. pavan
    pavan avatar
    17 posts
    Member since:
    Aug 2010

    Posted 27 Sep 2011 Link to this post

    Thanks for your quick reply.But our requirement is just Copy Paste the images or any graphics to Radeditor from local harddisk.Is this acheivable
  6. Stanimir
    Admin
    Stanimir avatar
    1654 posts

    Posted 30 Sep 2011 Link to this post

    Hello Pavan,

    Thanks for your quick reply.But our requirement is just Copy Paste the images or any graphics to Radeditor from local harddisk.Is this acheivable - No this is not achievable. Here is the detailed explanation of my colleague on the matter:

    "When copying an image from external location such as your hard disk or desktop program as MS Word document or a PDF file, then the image src points to your hard disk, which is not accessible in Internet and the other network / internet users will be unable to see it.

    In order to use images in a web page, they need to be accessible using HTTP protocol - that is, it means they must be uploaded to a web server (which can be your own computer of course, only that the images are provided by the web server software, and not by the operating system).

    Unfortunately the automatic image upload to the server is not possible with JavaScript code, because JavaScript cannot access the local file system from the browser - it would be a major security violation.

    The automatic image upload cannot be implemented without using ActiveX or another software, installed on the client. We do not use either technique because of browser compatibility and that the ActiveX components are forbidden by the corporate networks."

    Greetings,
    Stanimir
    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
Back to Top