Best Practices - Making files available for download

Discussion in 'ASP.NET / ASP.NET Core' started by Bruce, Oct 31, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Bruce

    Bruce DiscountASP.NET Staff

  2. Hi all!

    I have a few questions. I have my website writing files to a folder on the server. These files are essentially text files with the extension *.fnm. I'm trying to create a "control panel" interfacewhere someone can go download these files. I want the filenames to appear as links, and the user can click on whichever link the want to download the file for.

    What would be the best way to make those files appear on a page as links? if the folder on www.mydomain.com/folder has three files (test1.fnm, test2.fnm, test3.fnm), for example, how would I best make those three filenames appear as downloadable links on a page? I figure I could have the page that writes the files also create a link on this "control panel"page at the same time. Is there another, better or easier way to accomplish this? Is there a way to create code that would dynamically detect all the files in the folder when the user accesses the control panel page? The folder is NOT hooked up to a database at this time.

    Also, I've found that when I attach these files to an email, and someone goes to download them, the "Save As" dialog box defaults to a .txt file extension, so, unless the user understands that they need to change the file type to "All Files", they end up with "test1.fnm.txt". I've accepted this anomaly in my email attachments, but would like to find some way to write code or a script (ASP.NET or Javascript) that would automatically set up the proper file type when they click on the link to download the file. I'd like to make my "control panel" interface as user-friendly and comprehensive as possible.

    If anybody could get me started in the right direction (articles, code samples), I'd appreciate it. Frankly, I've got 4 or 5 really awesome ASP.NET books, but I don't even know what to search for in the index on this topic. I find nothing on the topics of downloading, file types, etc...

    Thanks in advance for all help!!

    ~Steph
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page