Dynamically setting Filenames for downloading file

Results 1 to 3 of 3

Thread: Dynamically setting Filenames for downloading file

  1. #1
    Troy Borja Guest

    Default Dynamically setting Filenames for downloading file

    We have a component that uploads a file to an SQL Server database. We aslo stored the FileName, FileSize and Content Type on SQL Server. A link was created on an ASP page to download the file stored in SQL Server. This was done by:<BR><BR>&#060;A HREF=http://mysite/GetFile.asp?ID=xxxx&#062;Download Me&#060;/A&#062;<BR><BR>GetFile.asp retrieves the file from SQL Server and sets the appropriate Request.ContentType. The download works fine, except the filename is always "GetFile".(file extension). For example, doc files become getfile.doc, Text files become getfile.txt. Since the FileName was also stored in SQL Server, is there a way to use this information during download? Any help would be greatly appreciated.

  2. #2
    Join Date
    Dec 1969
    Posts
    52

    Default RE: Dynamically setting Filenames for downloading

    For me, I would do away with GetFile.asp<BR>&#060;A HREF="http://mysite/&#060;%=rs("FileName")%&#062;"&#062;Download Me&#060;/A&#062;

  3. #3
    Troy Borja Guest

    Default RE: Dynamically setting Filenames for downloading

    Can&#039t just use the filename becuase the file does not exist on a directory. The file itself is stored in SQL Server. The GetFile.asp does the Getchunk from SQL Server and does the Response.BinaryWrite. We have also been successful in setting the correct Response.ContentType. The only problem left is getting the thing to download with the correct filename.

Posting Permissions

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