Force file download? Content-Disposition?

Hello,
I recently started using an X-Serve with OS X 10.4.8 installed.
This is my media server, and I'm trying to configure it to force a file download dialog when an mp3 file is pulled.
I used to do this by using an .htaccess file with the following:
<FilesMatch "*.mp3">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
But it doesn't seem to work now.
Do I have to add a new Content Handler? If so, what do I put to force a file download?
Thanks very much

See Oracle Metalink,
..Oracle Portal Technical Forum,
....Subject: PORTAL - uploading files (file attachments) with file names.
This message thread outlines javascript code that automatically captures the filename during an upload.

Similar Messages

  • Force file download for IE9 on Azure Blob Storage

    Hello,
    I am trying to use Azure Blob Storage as a location for secure file downloads using Shared Access Signature. Everything is working very well, however the problem I am having is I am trying to allow the user to save files from the browser and I have all browsers
    except IE9 working.
    Reviewing this question,
    What content type to force download of text response?
    this works well when I can control all of the headers, however in Azure Blob Storage, I have set the Content-Type to application/octet-stream and this allows all browsers except IE to ask the user to save the file, IE simply opens the file. It appears that
    known file types will open (example .jpg, .wmv etc…).
    In Azure, I have found no way to set
    Content-Disposition: attachment;filename="My Text File.txt"
    Is there a way, using Azure Blob Storage, to use IE to download any file directly from Azure Blob Storage?
    Thanks in advance.

    Hi,
    Actually, we can't set Content-Disposition for blobs, and I can't think of any other workarounds. From my experience, in most case IE's behavior is fine. I would like to know why you have to prompt a download? The user can see the text file, and
    if they wish to save it locally, they have more than one way to do that (copy paste, save file, etc.). If they simply want to read the text and then forget it, that's also fine. They don't even have to download it and then double click a local file to read
    the content.
    If you have to modify the behavior, the only workaround I can think of is to use a web role as an intermediate bridge, and add the Content-Disposition from your web role.
    Best Regards,
    Ming Xu.
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact
    [email protected]
    Microsoft One Code Framework

  • Download "Content-Disposition" to Excel

    I have a user who was having trouble getting an Excel file to download properly. When she clicked on the web link created by my procedure, her Excel file would download all the columns into one field. For myself, and most other users, it downloads normally with all the columns and fields where they should be. She was also missing the prompt asking if you wanted to open or save the file. It was just downloading to Excel right away.
    Now, the user said she did not have this problem with all her Excel downloads, just this one. So I looked at the program that had the Excel download that worked for her and compared it to the one that didn't.
    And there was a difference.
    The download that did NOT work for her had this line of code: htp.print('Content-Disposition: inline; filename='||v_file_name1);
    The download that DID work for her had this code: htp.print('Content-Disposition:attachment; filename='||v_file_name1);
    In the program that wasn't working for her I replaced the part of Content-Disposition with "attachment" instead of "inline". That seemed to do it. Nothing more needs to be done, but I dont' really know why it worked. I can't seem to find a definintion of what an "inline" Content-Disposition means vs. "attachment". Anyone know? Thanks!
    Oh, and here's the surrounding owa_util code in case that helps make it more clear where it was coming from:
    owa_util.MIME_HEADER('text/comma-delimited', FALSE);
    htp.print('Content-Disposition:attachment; filename='||v_file_name1);
    owa_util.HTTP_HEADER_CLOSE;
    Message was edited by:
    user527082

    I have a user who was having trouble getting an Excel file to download properly. When she clicked on the web link created by my procedure, her Excel file would download all the columns into one field. For myself, and most other users, it downloads normally with all the columns and fields where they should be. She was also missing the prompt asking if you wanted to open or save the file. It was just downloading to Excel right away.
    Now, the user said she did not have this problem with all her Excel downloads, just this one. So I looked at the program that had the Excel download that worked for her and compared it to the one that didn't.
    And there was a difference.
    The download that did NOT work for her had this line of code: htp.print('Content-Disposition: inline; filename='||v_file_name1);
    The download that DID work for her had this code: htp.print('Content-Disposition:attachment; filename='||v_file_name1);
    In the program that wasn't working for her I replaced the part of Content-Disposition with "attachment" instead of "inline". That seemed to do it. Nothing more needs to be done, but I dont' really know why it worked. I can't seem to find a definintion of what an "inline" Content-Disposition means vs. "attachment". Anyone know? Thanks!
    Oh, and here's the surrounding owa_util code in case that helps make it more clear where it was coming from:
    owa_util.MIME_HEADER('text/comma-delimited', FALSE);
    htp.print('Content-Disposition:attachment; filename='||v_file_name1);
    owa_util.HTTP_HEADER_CLOSE;
    Message was edited by:
    user527082

  • How to force file download message box appear????

    I download file from oracle
    how to set response header to make download message box appear??????
    I just see lots of :
    ���?������ Y�Dl?��>��hn��?g�x~����?7���}��h`a�F��?P?!P��*�X��?/?U ��A?|?/??$�T=��t ��?^!i��f��/?]?�c��7?�UZ�Gz?��SbU��p���Q�T������?��e JyN�/�X^��w��/Bo�k�O��������^��$��?�������yg���C(??[�[+?��R�����p��?te@?��o��?M:D�_s#h�����H��g/?�nE"�PQI���A!��bE������?C`A�������?V��2�^��<�NK?[��k�k$??yJ>?sg-hm�AW(���S��?l[��[���� ��?dL4��6!�N��*���N?Q2?���JoP��>|�sb�_�^�_����~�r��X
    on the screen
    I am a chinese, happy new year everyone!

    and the file.size() is semicode, meaning there isnt a function for it. So you might end up with something like this
         response.setContentType( "application/zip" );
         String fileName = Globals.getAttachmentLocation() + readFile;
         response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
         BufferedInputStream bufferedInputStream = new BufferedInputStream( new FileInputStream( fileName ) );
         ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         int start = 0;
         int length = 1024;
         byte[] buff = new byte[length];
         while ( bufferedInputStream.read( buff, start, length ) != -1 ) {
              byteArrayOutputStream.write( buff, start, length );
         bufferedInputStream.close();
         response.setContentLength( byteArrayOutputStream.size() );
         response.getOutputStream().write( byteArrayOutputStream.toByteArray() );
         response.getOutputStream().flush();

  • Force file download

    I am trying to create a page with downloadable pdf documents.
    The link should open a download dialog box to prompt the user to
    save or open the file, notjust open the file in the browser.
    I am using the code below which seems to work, except the
    files are unopenable. Acrobat says they are either a not supported
    file type or a damaged file.

    On a windows server, cfcontent requires an absolute path.
    Updated (working) code below.

  • Upload file - get rid of Content-Disposition: form-data;

    Hello,there.I just want to know if somebody had succesfully solved problem of getting rid of rows
    at uploaded file
    -----------------------------7d23c05be8
    Content-Disposition: form-data; name="fromflr"; filename="C:\WINDOWS\Desktop\Clock"
    Content-Type: text/plain
    "Some Data"
    -----------------------------7d23c05be8
    Content-Disposition: form-data; name="toflr"
    HARGAL
    I just need get rid of rows like
    -----------------------------7d23c05be8
    Content-Disposition: form-data; name="toflr"
    HARGAL
    and leave only "Some Data" in uploaded file.
    Any suggestion would be appreciate.

    See for example Upload taglib from Coldtags suite:
    http://www.servletsuite.com/jsp.htm

  • File download dialog box problem!

    Hi,
    How do you force file download message box to use specified file name instead of JSP or servlet name.
    I am using:
    // code in attachment.jsp
    <%
    response.setContentType(mimeType.trim());
    response.setHeader("Content-Disposition","attachment;filename=\""+attachmentViewBean.getAttachmentName()+ "\"");
    %>
    With the above code, browser first pop up file download dialog box informing
    'You are downloading the file:[attachment.jsp] from host. Would u like to open the file or save?'
    I want the file name that I had specified in setHeader("Content-disposition","attachment;filename=resume.doc") to appear(i.e. resume.doc) in above dialog box and not the servlet name.
    Any suggestions/tips on this?
    Your help would be greatly appreciated.
    Thanks,
    Yogesh

    For saving the document I have used -
    res.setHeader("Content-disposition", "attachment; filename="+ FileName );
    and it is working very fine, it saves the document with name specified in FileName
    For opening the file in browser without any prompt-
    res.setHeader("Content-disposition", "inline" );
    For setting the content type -
    try {
         if(FileType.equalsIgnoreCase("pdf")) contentType = "application/pdf";
         if(FileType.equalsIgnoreCase("doc")) contentType = "application/msword";
         if(FileType.equalsIgnoreCase("rtf")) contentType = "application/msword";
         if(FileType.equalsIgnoreCase("gif")) contentType = "image/gif";
         if(FileType.equalsIgnoreCase("jpg")) contentType = "image/jpeg";
         if(FileType.equalsIgnoreCase("html")) contentType = "text/html";
         if(FileType.equalsIgnoreCase("htm")) contentType = "text/html";
         if(contentType == null){
         contentType="text/plain";
         res.setContentType(contentType);
    } catch (Exception e){
              out.println("Exception while setting content type");
              out.println("Exception : " + e);
              return;
    Hope this helps

  • Setting the title for File download dialog when using content-disposition

    I am trying to send a file from server to client (browser). I am setting the content type of the resopnse and using the "content-disposition" header and giving the filename.
    But the issue is, when it is downloading and the dialog box is showing the progress bar, The title of the dialog box is showing something like "40% of localhost:9080.....". It doesn't show the file name in the title bar. Also, if the URL is very long (I am passing some get parameters and the servlet name is also long), I get junk characters like small boxes.
    How to set this title in the servlet?

    Is there a reason why you have to use FileReference.Save versus File.browseForSave?  In Adobe AIR, the File class, which extends the FileReference class,    provides more capabilities and has less security restrictions than the FileReference class.  Using File.browseForSave, it has a title:String parameter which is a string that is diplayed in the title bar of the dialog box.

  • Header variable: Content Disposition for downloading file over HTTP?

    Hi All,
    I have a general content server question...Is there anyway to pass a parameter or set a setting on the content server to send the file with the header variable content-disposition set so that when a user selects a file within a browser, it doesn't open in place but asks the user whether they want to open or save the document?
    Note - I'm actually using this with ArchiveLink and displaying the link in the Portal but this forum seems the closest I can get to asking this question.
    Regards,
    Matt

    Thanks Athol.
    Although there's quite a bit of configuration options there for displaying files, there doesn't appear to be anything that let's you manipulate the HTTP header variables to set content-disposition.
    Any other ideas?
    Cheers,
    Matt
    ps. If you want to artificially see the behaviour I'm after, within IIS, you can predefine this header variable for the contentserver.dll but this makes every HTTP request act like a file that wants to be downloaded, and it calls every file contentserver.<suffix>. From a user perspective, there's nothing worse than a document opening in place in your window (losing the underlying application), or within another IE window, hence why I'd like it to act like a file download.

  • Download File by url in another server? (Content-Disposition","attachment)

    Can the file be downloaded by a url in another server?
    ie.
    Server A: JSP program
    Server B: filepath + filename = "http://xxx.com/xx/x.doc"
    e.g.
        response.setContentType("APPLICATION/OCTET-STREAM");
           response.setHeader("Content-disposition", "inline" );            
           response.setHeader("Content-Disposition","attachment; filename=\""+ fn.trim() + "\"");     
              java.io.FileInputStream fileInputStream =new java.io.FileInputStream(filepath+filename);
              int i;          
              while ((i=fileInputStream.read()) != -1) {
                      out.write(i);
              fileInputStream.close();
              out.close();     

    I tried this but it doesn't work. In the report column it shows up as Download" >_ .
    This seems to indicate that the href code is not being interpreted correctly.
    Following is exactly what I have in the URL field:
    <a href="#OWNER#.DOWNLOAD_MY_FILE?p_file=#NOTIFICATION_SEQ_ID#&v_type=SUMMARY">Download</a>Yes, I have granted execute rights to the procedure.
    Thanks,
    Dale

  • 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

  • Open file without forcing to download?

    How do i open the file(.doc) in a new window upfront without forcing me to download( without the dialog box) on click of a link.
    I am using the following code to set the content-type and header.
    response.setContentType("application/msword");
    response.setHeader("Content-Disposition","filename=\"" +fileName +"\"" );
    Using this ,I sometimes get the file in a new window and sometimes in the same window...inconsistently.
    Thanks

    Opening in a new window is a Javascript or target issue. Try editing your link to the document.
    Something like:
    getDocument
    or
    getDocument

  • Problem with non-ASCII file name in content disposition header

    Hi All,
    I am facing some problems with the non-ASCII file name incase of content-disposition header. I read from the RFC 2183 that if the file name contains non-ASCII characters then the same should be encoded before sending to browser. I did the same but realized 2 problems:
    1. The name of the file is truncated in case the file name is slightly long for e.g. �����������j�b�g��������������������������.txt
    2. Also when the same file is opened in notepad, the title is showing encoded name %E6%9C%80%E4%B8%8A%E4%BD%8D.....
    Overall, I feel that the browser is not understanding or responding to the encoded header values.
    Is there any solution to this problem? I am using Microsoft IE 6.0.
    The code snippet is given below:
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              String fileName = "�����������j�b�g��������������������������.txt";          
              fileName = URLEncoder.encode(fileName, "UTF-8");
              resp.setCharacterEncoding("UTF-8");
              resp.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
              resp.setContentType("application/download-binary");
              String s = "This is inside txt file";
              resp.getOutputStream().write(s.getBytes("UTF-8"));
              return;
         }Any help or pointer would be highly appreciated.
    Thanks and Regards,
    Ashish

    The MIME standards for non-ASCII filenames are not widely implemented.
    Many mailers use an ad hoc method for encoding filenames. JavaMail
    supports both methods, but you need to set properties, such as the
    mail.mime.encodefilename property. See the JavaMail javadocs for
    the javax.mail.internet package.

  • Facing problem with posting Excel file for download - Content in browser

    I am trying to post an Excel file to download from a servlet to a JSP. The content is written properly but to the IE browser and not in an Excel. I even tried giving the ContentType as Word/CSV etc. But nothing works, the content gets displayed only in the browser.
    PLEASE HELP.
    Code snippet in calling JSP:
    DownloadServlet downServlet = new DownloadServlet();
    downServlet.download(response);
    Code in Servlet:
    public class DownloadServlet extends HttpServlet{
    public void download(HttpServletResponse response) throws IOException {
              /*PrintWriter out = response.getWriter( );
              response.setContentType("text/html");
              out.println("<H1>Hello from a Servlet</h2>"); */
         /*HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("Sheet1");*/
    String strData = "This is a Test for Download";
    byte[] b = strData.getBytes();
    //response.reset();
    response.setHeader("Content-disposition", "attachment; filename=" + "Download.xls");
    response.setContentType( "application/msword" );
    //response.addHeader( "Content-Description", "Download Excel file" );
    ServletOutputStream out = response.getOutputStream();
    out.write(b);
    //out.flush();
    out.close();          
    }

    Hi Naresh,
    My thoughts on a possible solution, convert the last character value to a HEX value and check if it falls within the ASCII/Unicode CP range, Obviously this becomes easier if you are just looking at a single language character set.
    The below FM and code helps you check if the character falls within the ASCII char set.
    DATA: l_in_char TYPE string,
          l_out     TYPE xstring.
    CALL FUNCTION 'NLS_STRING_CONVERT_FROM_SYS'
      EXPORTING
        lang_used                   = sy-langu
        SOURCE                      = l_in_char
      TO_FE                       = 'MS '
    IMPORTING
       RESULT                      = l_out
      SUBSTED                     =
    EXCEPTIONS
       illegal_syst_codepage       = 1
       no_fe_codepage_found        = 2
       could_not_convert           = 3
       OTHERS                      = 4.
    IF l_out LT '0' OR l_out GT '7F'.
      WRITE: 'error'.
    ENDIF.
    Links: http://www.asciitable.com/
              http://www.utf8-chartable.de/unicode-utf8-table.pl
    Regards,
    Chen
    Edited by: Chen K V on Apr 21, 2011 11:25 AM

  • Content file download failed.

    I haven't been able to find anything on this anywhere. Trying to get Windows 8.1 Update (KB2919355) to download, but it keeps failing.  I'm using WSUS 3.2 on Server 2008 R2, 156GB free space on E drive.
    This error has been occurring since April, but all other updates are downloading fine.  If I sort by file status, only the 3 updates for 8.1, 8.1 x64, and 2012 R2 are stuck trying to download.
    Anyone have any ideas?
    Event ID 364:
    Content file download failed. Reason: An attempt was made to move the file pointer before the beginning of the file.
    Source File: /msdownload/update/software/crup/2014/02/windows8.1-kb2919355-x64_66955196a82751d1c8d9806d321487562b159f41.psf Destination File: E:\WSUS\WsusContent\41\66955196A82751D1C8D9806D321487562B159F41.psf.

    Anyone know if this is still an issue in WSUS 3.2:
    http://support.microsoft.com/kb/974500/en-us ?
    All existing WSUS v3.2 hotfixes were rolled up into KB2720211 (so they are also present in KB2734608, KB2828185 and KB2938066).
    [Edit] Ehhhh. but that's actually a WUA issue that's *not* been resolved to my knowledge. It's not really a bug, just a fact of how the WUA caches content.
    Method #2, however, should be the option of FIRST choice. DECLINE the update, and force a client detection. But note that even this methodology is designed to be a *reactive* response, only if the client freaks out.
    Then, once the client knows the update is no longer available, you can re-approve the update, and the WUA will RE-download the content that is available. (Of course.. what's also not written in that KB article is that the 'issue' only applies to updates
    that actually HAVE EIFs that the client can download!) :-)
    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

Maybe you are looking for

  • I need some help with AVI and IDX files please.

    Hello there, I've just been given a hard drive with a load of media on it that I need to work with in FCP. There's a folder with many .AVI clips, and each clip has an accompanying directory file with the extension .IDX The format of the AVI files is

  • Warning Message at time posting Invoice for Advance Payment alrady made

    Dear Sir,     I want to get a Warning Message at time posting Invoice for Advance Payment alrady made. Please tell me the cofigaration. Regards, David

  • Is it possible to run a JAR?

    My high school Computer Science teacher thinks it might be possible to run a JAR file in windows and have it run the java program (command promt type) in windows. I do not believe this is possible but he wanted me to check and see. Also is there any

  • ITunes error: The required file is locked.

    I'm getting an iTunes popup error message: 'The iPod "Mark's iPod" cannot be synced. The required file is locked.' Any ideas on clearing this guys? I've tried uninstalling iTunes, reseting the iPod, checking file permissions in the iTunes Music folde

  • InDesign/Creative Suite Installation Problem

    I just installed Adobe Creative Suite 5.5 to a new iMac, using the Adobe chat to assist. Both Photoshop and Illustrator open without any problems. But InDesign will not open. I did use the Mac Migration Assistant progrtam to move everything from my o