How do I force a file download from a folder above the root?

I am new to ColdFusion and need some help. I set up a virtual folder on my website and then mapped in the CF9 admin panel to a "Docs" folder above my root, where I would like to store sensitive documents. CF tags are enabled.
I know that my mapping is set up correctly, because when I set up a cfm page with the following code, I can successfully download the file:
<cfheader name="Content-Disposition" value="attachment; filename=Calendar.pdf">
<cfcontent type="application/pdf file=/Docs/Calendar.pdf">
But what I need is to create one cfm age that will be able to handle downloads of multiple files types and names from the folder above my root.
I then found Duke Snyder's solution on an older forum for the "click link and download file" question where he suggests making a "download.cfm" page with the following code:  I did this, and named the file "download.cfm"
<cfsetting enablecfoutputonly="yes">
<cfheader name="Content-disposition" value="attachment; filename=""#Url.FileName#""">
<cfcontent type = "foo/bar" file = "/Docs/#Url.FileName#">
Then Duke suggests: "Now I pass the FileName through the Url and it WILL ask if you want to open or download the file. We accomplish this by making up an eronious file type."
I then set up a password-protected page on the site that lists the titles of a number of documents, with links to the virtual folder, where they can be downloaded.  One of the links, which goes to "Calendar.pdf" I constructed as: "download.cfm?FileName=Calendar.pdf"  When I click on the link, I get the popup box that says "Do you want to open or save this file?  With the name listed as: "download.cfm?Filename=Calendar_pdf"
When I click "Save", I get the message: "Internet Explorer cannot download download.cfm from www.... Internet Explorer was not able to open this Internet site.  The requested site is either unavailable or cannot be found. Please try again later.
I must have constructed the link incorrectly. Any ideas?  Thanks in advance for your help.

I am trying to force the download of pdf files from a folder above the root.  The file below is named "download.cfm"  I pass the name of the file (Calendar.pdf) in the URL link, as follows: download.cfm?filename=Calender.pdf
In the ColdFusion admin panel, I mapped a folder in the root "Docs"  to point to a folder with a different name above the root.   I have tried the code below, which was generously supplied by another member of this forum, but it does not seem to recognize the CF mapping. Do I need to use another CF Tag for the mapping to working correctly?
<cfsetting enablecfoutputonly="yes">
<cfheader name="Content-disposition" value="attachment; filename=""#Url.FileName#""">
<cfcontent type = "application/pdf" file = "/Docs/#Url.FileName#">
Thanks for your help

Similar Messages

  • How do I force a re-download from I tunes store?

    My application, Frog toss, for my I touch, is corrupt. It will not load. SO I unchecked the sync box and it removed it from my I touch.
    Then when I restarted everything (I touch and computer) I re-checked the box.. Now it says the application file is not there.
    And when I went to the I tunes store, it said I downloaded it, but it will not allow me to re-download it.
    How can I force (make) it re-download it?
    I tried a global search on my HD for the file and it got erased somehow..
    Thanks.

    Try deleting it from the iPod and then redownlng it to the iPod by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • How to upload all excel files data from one folder into internal table.

    Dear All,
    I have one requirement, It is like I want to upload the frontend file data into my internal table, But here my scenario is;
    If I have one folder ( Called : Temp) in my frontend system, in this folder ( Called : Temp)  I have 100 excel files. In each excel file I have some 1000u2019s of entries. All these data of every file I want to take into my internal table.
    If I have one file I can go for, CALL METHOD cl_gui_frontend_services=>file_open_dialog and then upload method to upload. But I want to take all these excel files from that folder at a time, is there any class or any thing is there..? plz help..
    Thanks...
    Edited by: satishsuri on Jan 11, 2011 9:33 AM

    Hi satishsuri ,
    You will have to use 3 methods together :
    CALL METHOD cl_gui_frontend_services=>directory_browse "Browse the Directory
    CALL METHOD cl_gui_frontend_services=>directory_list_files "Get all the files from the directory
    CALL METHOD cl_gui_frontend_services=>gui_upload "Upload each file in a loop
    Example:
    TYPES: BEGIN OF ty_data,
             line TYPE string,
          END OF ty_data.
    DATA: str_file TYPE string,
          str_dir TYPE string,
          it_file_table TYPE STANDARD TABLE OF file_info,
          wa_file_table TYPE file_info,
          v_count TYPE i,
          it_data TYPE STANDARD TABLE OF ty_data,
          wa_data TYPE ty_data.
    CALL METHOD cl_gui_frontend_services=>directory_browse
      CHANGING
        selected_folder = str_dir.
    CALL METHOD cl_gui_frontend_services=>directory_list_files
      EXPORTING
        directory  = str_dir
      CHANGING
        file_table = it_file_table
        count      = v_count.
    LOOP AT it_file_table INTO wa_file_table.
      CONCATENATE str_dir wa_file_table-filename INTO str_file SEPARATED BY '\'.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename = str_file
          filetype = 'ASC'
        CHANGING
          data_tab = it_data.
      LOOP AT it_data INTO wa_data.
        WRITE : / wa_data-line.
      ENDLOOP.
      ULINE.
    ENDLOOP.
    Regards,
    Jovito

  • How can I restore deleted file attachments from further back than the history tool will let me go?

    I have a open form that collects registration information from customers, including documents and images that they can upload using file attachment fields.  Back on 2/24 I inadvertently deleted the several hundree responses that the form had collected up until that point.  Using the history tool, I accessed older, intact versions of the form, selected the deleted rows, and copy/pasted them back into the latest verskon of the document.  It seemed to work fine, but I didn't look closely enough to see that the attachments had been lost.  The file referenvces were still there, but they had little red exclamation marks next to them and couldn't be opened.
    A couple week later, I discovered this and tried to go back into the form's hsitory again until before that accident on 2/24.  However, I can no longer go back in time that far.  The system only seems to let me go back around 10 days.
    We need to recover the lost file attachmentrs.  Is there  a self-service way for me to restore my form back to 2/24, including file attachments?  If not, could an Adobe supprrt technician hele me to do that?
    Thank you

    lol, nevermind. I came across an article that made it easy. For anyone else with this problem it's real simple.
    Open itunes
    File>Add Folder to Library
    select 'itunes' and it will add your music to your library
    Although it went through all my apps asking if I want to replace or don't replace with newer, when it finished all my music appeared in itunes just like I left it before reinstalling Win 7. Easy Peasy. I've seen others with same problem but nobody seemed to have this easy solution.
    Now I can finally plug in my iphone and sync without losing all my music from my iphone.

  • How to delete a specific file type from a folder

    Hi,
    I have folders with lots of zip or rar files, once I decompress those I want to delete the compressed files specifically. Is there any way I could manage that through Automator?
    Thanks in advance.

    Thanks Niel for the script, unfortunately I am too ignorant about running these on my own, I did save it in my user script library, but I would need instructions to run it. I would be really grateful.
    I did try making up my own workflow using the given actions in Automator, the first action was to 'find specific files in finder' ending with .zip and .rar and then choosing another action which 'moves selected files to trash'. Unfortunately it ended up running only if I specify the path to the specific .zip file, which defeats the purpose. Any suggestions on the proposed workflow? Thanks in advance.

  • Just upgraded to Lion, can't open any pdf file downloaded from internet that was fine with Leopard. How can I overcome this obstacle ?

    Just upgraded to Lion, can't open any pdf file downloaded from the internet that was fine with Leopard before. I just got a black screen when I clicked on a pdf icon on a given internet site, and same happened with several sites that I visited. How can I overcome this obstacle ?

    Try two things with Safari not running:
    1) Launch Adobe Reader, open its preferences, select the Internet category, and check the values under "Display PDF in browser using".  If it's checked, try unchecking it.
    2) Look in /Library/Internet Plug-Ins (at the top-level of your boot volume) for something names AdobePDFViewer.plugin.  If you see such a file, try moving it to a folder named "Disabled Plug-Ins" (if such a folder exists) or onto the Desktop.
    Then see how things work.

  • PLEASE HELP i get error:The operation couldn't be completed. (com.apple.installer.pagecontroller error -1.) when trying to open a .pkg file downloaded from microsoft store. they said it needs to be dmg but how?

    i get error:The operation couldn’t be completed. (com.apple.installer.pagecontroller error -1.) when trying to open a .pkg file downloaded from microsoft store. they said it needs to be .dmg file but how?

    Student_245,
    are you certain that you’ve completely downloaded the .pkg file — that the download didn’t end prematurely?

  • How can I save the .mp4 files downloaded from internet to ipad memory so that I don't have to download everytime to view them again

    How can I save the .mp4 files downloaded from internet to ipad memory so that I don't have to download everytime to view them again. Also they might remove them from internet so I can't rely on the bookmark to them.

    I'm trying to send home movies to my 10 year old nephew who lives across the country. He doesn't have a computer. He has an iPod touch. His parents have computers. But I don't want everything I ever try to have him do result in "you need your parent's computer for this." It's getting really embarrassing. I have converted my family over to Apple computers but now they want to buy iPhones, iPads, and iPods even though I tell them to go Android. It took a decade to convert them away from windows now I'm trying to keep them away from these freedom limited iOS devices and they won't listen. Then it becomes my responsibility to make their iPads print to their fancy pre-airprint color laser jet printers, get home movies onto them, and countless other things. It's driving me nuts.
    I have converted these files to a format that the iOS devices will play directly off of dropbox. Now, how do I get the infernal devices to save it instead of play it?

  • Files recently downloaded from Canon Legeria FS306 do not play the audio. Can hear audio on camera or downloading same files to a PC. Also hear audio on earlier files downloaded from same camera to iMovie '11. How do I avoid problem & recover lost audio?

    Files recently downloaded from Canon Legeria FS306 to iMovie '11 do not play the audio. I can still hear audio on the camera or by downloading the same files to a PC. Can also hear audio on earlier files downloaded from the same camera to iMovie '11. How do I avoid this problemand recover lthe ost audio?

    The first thing to try is to run Software Update (the Update tab in the Mac App Store.). This was an issue a couple of releases ago, and an update seemed to fix it.
    If you are already at the most recent version of iMovie, then I don't know how to solve you issue. Maybe someone else will have some ideas.

  • How do i find a .mp4 file downloaded from email to my iphone

    How do i find a .mp4 file downloaded from my gmail email to my iphone. Unable to locate the file or maybe not sure how to go about it?

    You don't, as ringtones are a one time purchase and as such can't be redownloaded.
    If you still have them on your iTunes library, you may sinc them from there.
    If you have a backup that contains them, you may restore your phone from that backup.
    Or you can go to expresslane.apple.com and try for a re-issue. Which they do only occasionally and depending on the circumstances.

  • Questions regarding jsp file download from blob

    Hi developers, i'm doing jsp file download from a blob column in DB2 using struts,
    1) How do i design the jsp page such that the page will show perhaps a hyperlink for me to download the file?
    2) What about struts-config.xml? Do i need to modify any mappings there?
    It would be great if some kind developers were to provide some sample codes for me. Thanks alot. Your effort is kindly appreciated.

    http://kr.forums.oracle.com/forums/thread.jspa?threadID=1982213 - looks similar, you may need to change contentType as per use case

  • Force flash to open file download box in front of the flash movie

    Folks,
    I'm making a dvd title using flash to auto start when people
    pops the dvd disc in.
    I have a button 'Click here to download the movie' and
    clicking the button should pop up a file download box so people can
    save the movie file(.mov) to their desktop.
    Problem is that the file download box shows up behind the
    flash movie so people won't be able to see the download box since
    it's hidden behind the flash. This is critical since I intend the
    flash to open as a full-screen mode.
    Is there a way to force the flash to open the download box in
    front of the flash movie?
    I tried getURL and fscommand ("exec", "filename.exe") and
    even fileReference commands to try different way of linking the
    movie file, and they all open download box behind the flash.
    Please help~~~

    Please do not post the same topic in multiple forums. The
    only thing I can suggest is when they click on the button to
    download, you take flash out of full screen while they download the
    video, you can use fileReference to control and monitor the
    download. Use a listener object to monitor when download is
    complete, then set flash back to full screen.
    How are you scripting the full screen?

  • Jar files downloaded from SkyDrive are being renamed to jar.zip files

    I have cut and pasted the following series of exchanges from when I posted the problem onto SkyDrive's support forum. I hope that someone might be able to propose a better solution to the problem that I have. Thanks for your help.
    MDSms asked on
    Uploaded jar files convert to jar.zip files when downloaded from SkyDrive
    I have uploaded an executable jar file to SkyDrive. (I will call this FILE.jar). The file is intact and indicates that it is a jar file type when the file is viewed by Properties within Skydrive. However, when I download (or others download through a share link) the file, it is being saved onto the local computer's download file with .zip appended to the file name (FILE.jar.zip). The downloaded file can be renamed to remove the .zip appendage and subsequently run successfully. However the folder options for the folder where the downloaded file resides must be changed for disable "Hide known file extensions" prior to being able to remove the .zip appendage. While I have figured out the workaround for this problem, this manual renaming procedure is entirely too cumbersome as a solution for sharing this file with others. How can I prevent or disable the FILE.jar file from being renamed to FILE.jar.zip when it is downloaded from SkyDrive?
    All Replies (5)
    Audrey_P. replied on
    Forum Moderator
    Hi,
    Thank you for posting. Let me try to assist you with your issue with your files.
    In order for us to reproduce the issue on our end. Please provide us with the exact steps that you did when you uploaded the files as well as the steps when you are downloading it.
    We will be needing the steps to help us figure put what is causing you this issue.
    We look forward to your response.
    Thank you.
    Audrey P.
    MDSms replied on
    Reply
    The file was uploaded by first logging onto my SkyDrive account using Windows 7 Pro and Firefox browser, then a new folder in my account was created without sharing privileges, then the folder was opened and the FILE.jar was uploaded into the folder using the "Upload" option on skydrive account menu. Sharing privileges for FILE.jar were then created (view only), and the shortened url link was sent to the individuals that I was trying to share the file with. was then turned on. When these people use the link to download the file, it is being saved as FILE.jar.zip.
    When I try to download the file through the skydrive account download option, it is being saved onto my computer as FILE.jar.zip and this occurs when I try to download the file while signed into my skydrive account as well as when I am not signed into my skydrive account (using the shared file link).
    This PNG shows the information provided by clicking on the download icon (down arrow) within the Firefox browser; note that the file was downloaded as FILE.jar.zip and that the source was live.com. When I use Windows Explorer to look at the same file within the Download folder itself, examining the file's properties details also shows that it is being saved as FILE.jar.zip and is of the file type compressed zip folder.
    This PNG shows the information displayed to me from my skydrive account when I view the originally uploaded file's properties; note that the information shows that the file is a jar file type.
    When I utilize Internet Explorer 9 to access the file, FILE.jar is being downloaded onto my computer as a jar file type. This PNG shows the information provided by Tools/View Downloads within the IE9 browser. Note that in this instance, the information indicates that the file is being downloaded from yzudea.blu.livefilestore.com.
    It appears to me that the problem (the FILE.jar file being renamed to FILE.jar.zip) arises from the fact that a jar file downloaded from skydrive using firefox, is being sent from live.com whereas a jar file downloaded from skydrive using IE9 is being sent from yzudea.blu.livefilestore.com.
    I want to make sure that a person receiving a share link from me for FILE.jar is able to download it without modification to the file name regardless of which browser is being using to access the link. How can I make sure that this occurs?
    Any help is appreciated. Thanks.
    Michelle Anne D. replied on
    Forum Moderator Community Star Community Star
    Reply
    Hi MDSms,
    I appreciate you for providing as much information as you can about the issue, as well as for uploading screenshots on what you see from the downloaded file. About your initial concern wherein the file gets renamed with .zip after the original file extension, this is solely dependent on the browser that you are using since they have a different safety/security measure that needs to be implemented.
    Moreover, you may see the file servers live.com and yzudea.blu.livefilestore.com to be different with one another, but they actually are sent from the same SkyDrive server. This in turn, depends on the web browser where the file is being downloaded as well. The live.com file where it was downloaded from Firefox simply masks its original server yzudea.blu.livefilestore.com.
    As for your last query about your recipients downloading the file without the hassle of renaming it from a .zip file, you can simply tell them to download it through Internet Explorer.
    Should you have other queries or additional information that might help in our investigation, I highly encourage you to post them here.
    Regards,
    Michelle
    MDSms replied on
    Michelle,
    Thanks for your reply. Yes, I could simply tell them to download the file through Internet Explorer, but is there another solution or workaround to the problem I have described here? Am I being punished with the curse of this problem simply because I (or the individuals with which I wish to share FILE.jar with) choose to use Firefox instead of IE? Will the use of any other browser instead of IE (Chrome, Safari, etc., etc.) still result in the same problem?
    You stated that it is "solely dependent on the browser that you are using since they have a different safety/security measure that needs to be implemented"........could the problem be overcome by designating one or both of the file server addresses as Trusted Sites within the browser options setting?
    I look forward to your response. Thanks in advance.
    Joy V. replied on
    Forum Moderator Community Star Community Star
    Reply
    Hi MDSms,
    We understand your concern. Since the issue does not occur in Internet Explorer, it has something to do with Firefox's security feature. You might want to verify this concern by contacting Firefox support.
    Hope this helps. Let us know if we can further assist you with SkyDrive.
    Thanks,
    Melanie Joy

    Try to delete the mimeTypes.rdf file in the Firefox profile folder to reset all file actions.
    *http://kb.mozillazine.org/mimeTypes.rdf
    *http://kb.mozillazine.org/File_types_and_download_actions#Resetting_download_actions

  • How do I delete "Pending Available Downloads" from my queue?

    How do I delete "Pending Available Downloads" from the list permanently?  I got a full season of a TV show, and all the HD versions won't go away!

    Hi. I googled How to Delete Pending Downloads in iTunes and I found this info on answers.com. It worked for me. I had 35 pending downloads and every time I tried to delete them, they reappear every time I open iTunes and automatically start downloading to my pc. So annoying! Good luck...
    On PC, go to /Users/yourUserName/Music/iTunes/iTunes Media/Downloads/ 
    Delete any folder for the download you want to remove
    Delete the file list.plist 
    When you next start iTunes or update apps the unwanted download will not start  
    If you interrupt a download in the future a new list.plist will be created containing the interrupted download and the original unwanted download
    http://wiki.answers.com/Q/How_do_you_remove_pending_downloads_from_iTunes

  • Make files downloadable from outside tomcat(web) context

    Hi there,
    I made an application on whicht people can upload word/pdf files.
    I put them in a dir called /opt/customer/2342/ , where 2342 is the customer id.
    The files are stored there, because I don't want people to be able to just download the files by using http://www.blahblah.com/customer/2342
    Now I want to create a servlet or jsp file that is able to make the files downloadable for specific users.
    Of course I can find the files using java.util.File. But I don't have a clue how to make them downloadable from this path. Should it be something with a FileStream... ?? And adding the mime-type?
    Can anybody give me some hints on making files downloadable from a specific dir?
    Thanks in advance.
    Jeroen van Hertum

    here is a servlet that is used to load files that are stored on the file system. The user submits the file path releative to a know file path.
    package common.servlet;
    import java.io.*;
    import java.net.*;
    import javax.naming.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.apache.log4j.Logger;
    public class FileResourceServlet extends HttpServlet
        // -------- Static fields ----------------------------------------------
        // Logger
        private static Logger logger = Logger.getLogger(FileResourceServlet.class.getName());
         * Root context for all JNDI lookups
        private static final String ROOT_CONTEXT = "java:comp/env";
         * JNDI lookup name of the binary path value
        private static final String BINARY_PATH_KEY = "binaryPath";
         * Default in case looking it up from the environment fails
        private static final String DEFAULT_FILE_RESOURCE_PATH = "/home/cp/bin";
        // -------- Fields -----------------------------------------------------
        private String fileResourcePath = null;
        // -------- Methods ----------------------------------------------------
         * Initializes the servlet.
        public void init(ServletConfig config) throws ServletException
            super.init(config);
            try
                //Get Norm's info
                Context initCtx = new InitialContext();
                Context envCtx = (Context)initCtx.lookup(ROOT_CONTEXT);
                fileResourcePath = (String)envCtx.lookup(BINARY_PATH_KEY);         
            catch( Exception e )
                logger.error("Error looking up file resource path, going with " +
                             "default value - " + DEFAULT_FILE_RESOURCE_PATH, e);
                this.fileResourcePath = DEFAULT_FILE_RESOURCE_PATH;
            logger.debug("File Resource Path:" + fileResourcePath );
         * Destroys the servlet.
        public void destroy()
         * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
        protected void processRequest(HttpServletRequest request,
                                      HttpServletResponse resp)
                                      throws ServletException, IOException
            ServletContext sc = getServletContext();
            String pathInfo = request.getPathInfo();
            logger.debug("Path Info: " + pathInfo);
            if (pathInfo!=null && !pathInfo.startsWith("/")) pathInfo = "/" + pathInfo;
            String filename = fileResourcePath + pathInfo;       
            logger.debug("Binary Filename:" + filename );
            // Get the MIME type of the image
            String mimeType = sc.getMimeType(filename);
            if (mimeType == null)
                //sc.log("Could not get MIME type of " + filename);
                logger.warn("Could not get MIME type of " + filename);
                resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                return;
            // Set content type
            resp.setContentType(mimeType);
            // Set content size
            File file = new File(filename);
            resp.setContentLength((int)file.length());
            // Open the file and output streams
            FileInputStream in = new FileInputStream(file);
            OutputStream out = resp.getOutputStream();
            // Copy the contents of the file to the output stream
            byte[] buf = new byte[2048];
            int count = 0;
            while ((count = in.read(buf)) >= 0)
                out.write(buf, 0, count);
            in.close();
            out.close();
         * Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doGet(HttpServletRequest request,
                             HttpServletResponse response)
                             throws ServletException, IOException
            processRequest(request, response);
         * Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doPost(HttpServletRequest request,
                              HttpServletResponse response)
                              throws ServletException, IOException
            processRequest(request, response);
         * Returns a short description of the servlet.
        public String getServletInfo()
            return "Short description";
    }

Maybe you are looking for