More in this section

Forums / Developing with Sitefinity / forcing download of document in library

forcing download of document in library

5 posts, 0 answered
  1. Mike
    Mike avatar
    208 posts
    Registered:
    10 Dec 2007
    24 Jan 2009
    Link to this post
    Hopefully this will be a simple question.  ;^)

    I'm inserting a PDF document link into a Generic Content field on a page...This opens in the same (or new) window.  Is there a way to force the file to download instead of rendering?  I know how to do this manually outside of Sitefinity by changing the MIME type...but I need something my users can do from the editing environment.

    Thanks
    Mike
  2. Mike
    Mike avatar
    208 posts
    Registered:
    10 Dec 2007
    24 Jan 2009
    Link to this post
    Also, I notice now that there isn't an option to open a link in a new window either (no way to set the target).  I'd prefer my users not have to switch to the HTML view and do this manually.  Any help here?

    thanks again
    Mike
  3. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    27 Jan 2009
    Link to this post
    Hi Mike,

    Thank you for contacting us.

    We suppose that while editing the Generic Content item, you selected Insert a document button from the RadEditor's menu, then selected a file from the already uploaded ones.

    1. Replace the file located in 
    [your site]\Sitefinity\Admin\ControlTemplates\Libraries\Dialogs\DocumentEditorDialog.ascx
    with the attached in this response file DocumentEditorDialog.ascx

    2. When you select a document there, you will see a checkbox which indicates if the file is for downloading or not. (see the attachment documenteditor.jpg)

    If the user checks the checkbox, the file will be downloaded when requested (the query string ?download=true is appended to the file's url)

    Hope this information will help you.

    All the best,
    Parvan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. Mike
    Mike avatar
    208 posts
    Registered:
    10 Dec 2007
    27 Jan 2009
    Link to this post
    Thanks Parvan,

    That will work great.  I'm concerned that a Sitefinity upgrade will overwrite this change, though.  I've been trying to avoid changing out-of-the-box SF files, opting to add customized files where I need to make changes.  Is there a way to use this dialog as, say, "CustomDocumentEditorDialog.ascx" and then configure the radEditor to use the custom dialog instead, so that a Sitefinity upgrade won't break my customization?

    Thanks,
    Mike
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    28 Jan 2009
    Link to this post
    Hello Mike,

    This is exactly what we are trying to introduce with 3.6 and the embedded templates - not to override your customizations. Sitefinity 3.6 will come with embedded templates. It will by default use its own embedded templates, and your external ones will not be affected. Then, you can set Sitefinity to use the external template.
    We will provide some more information before the release.

    All the best,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
5 posts, 0 answered