Home > Net >  Currently doing a web system, you need to add additional download function, how to implement this fe
Currently doing a web system, you need to add additional download function, how to implement this fe

Time:10-07

In using asp.net MVC to do a web system, you need to add additional download function, all attachments in a folder, folder will contain the files and subfolders, as to which file contains no analysis in advance, may not updated regularly, what better way to implement this function?

CodePudding user response:

The need to download the file away web directory, make a special place to store,
Database to build a table, save resource name - & gt; File name or path name mapping (such as a count=25, file/data/download/6512 bd43d9caa6e02c990b0a82652dca),
When people visit xxx.com/down/25, set the mime type to application/octet stream, read the file and push the binary stream in the past,

CodePudding user response:

Direct data inventory URL, the page can & lt; A href="https://bbs.csdn.net/topics/file path" & gt; Download & lt;/a>

CodePudding user response:

refer to the second floor zhulong1111 response:
direct data inventory URL, the page can & lt; A href="https://bbs.csdn.net/topics/file path" & gt; Download & lt;/a>

Has nothing to do with the database as far as possible, the folder contents may change often

CodePudding user response:

System. IO. Directory. GetFiles ()

CodePudding user response:

The most simple, suitable for small files, it is on the server to generate a physical file, and then on a page to a virtual address the physical files can, such as http://xxxx.com/data/file/xxxx.doc

If it is a large file, you'll need to use the download flow
  • Related