Hyperlink on form set to Download only, is that possible? - InfoPath Dev
in

InfoPath Dev

Hyperlink on form set to Download only, is that possible?

Last post 01-14-2013 06:08 PM by JenniferLindsay. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-28-2012 01:32 AM

    • JimiH
    • Not Ranked
    • Joined on 06-15-2012
    • Posts 18

    Hyperlink on form set to Download only, is that possible?

    Hello

     As the title says, I have a form with links to a document library. When a user clicks one of the links

    i want the link not to open the file but download it.

    Is that possible?

    thanks

    Geoff

  • 01-14-2013 06:08 PM In reply to

    Re: Hyperlink on form set to Download only, is that possible?

     

     Hi JimiH,

     Believe it or not, this has nothing to do with InfoPath and everything to do with the way browsers interpret links. 

    What you will need is to upload a script to your site that will force links to download, and then to modify the links in your form in such a way that the script is called and download is forced. 

    Here's a link to a PHP script I've used before: http://www.zubrag.com/scripts/download.php

    Now, there's a lot of stuff in this script, but to do what you want you will need to modify only two lines:

    (1) define('BASE_DIR','/home/user/downloads/'); <-- change the /home/user/downloads/ to point to the document library you want to download from

    (2) $allowed_ext = array (  <-- after this line make sure to add any MIME types you will need that are missing from the default script (here is a list of MIME types)  If you're in a hurry, the MIME type for xml forms and xsn templates is 'application/xml'

     Now supposing you've uploaded the download script to the following location: mysite.com/path/to/script/

    Then the link to download a form called "myForm.xml" in your document library (the same library you entered the path to in (1) above) would look like this:

     http://mysite.com/path/to/script/download.php?f=myForm.xml

     So just add a hyperlink that looks like this inside your form, and then when the user clicks the link he/she should be immediately prompted to download the file.

     Good luck!

    Jennifer Lindsay
    Qdabra® Software/InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.