SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy downloading files from a database

    We've got an .asp page that uses Response.ContentType and Response.BinaryWrite to download files and we're observing some odd behaviour. Say, for example, the asp page is called filedownload.asp

    a .doc (application/msword) when downloaded shows a prompt in IE:

    You are downloading the file
    filedownload.doc from <server>

    however

    a .txt(text/plain) when downloaded shows a prompt in IE:

    You are downloading the file
    filedownload.asp from <server>

    Does anybody know how or why this happens? That is, why the word document presents a .doc file but the text file *inherits* the real name of the page downloading, i.e. .asp and not .txt.

    Is it a server setting or something on the client?

    Josh

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Without sending the real filename as part of the HTTP header, IE will guess at what it should be based on the name of the script and the ContentType that you have specified.

    See here for my all-in-one solution:
    http://www.sitepointforums.com/showt...threadid=67307

    Some more discussion here:
    http://www.sitepointforums.com/showt...threadid=65837
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •