ASP gets files from the database

xiaoxiao2021-03-06  56

Database Table INFO, Table Structure: INFO_ID INT Primary Key File_Mime_Type Varchar (50) File MIME Type File_Size INT File Size Info_File Image File

File name of the following code: getfile.asp <% @ language = vbscript%> <% info_id = request ("info_id") set = server.createObject ( "adoDb.recordset") SQL = "Select * from info where info_id =" & info_id = "file_mime_type") response.addheader "Content-Length", RS ( "File_size") response.addheader "Content-Disposition", "Attachment; FileName =" "" "" "" "" "" "" response.binaryWrite RS ("info_file") rs.close set = Nothing conn .close set conn = Nothing%>

How to get the picture is How to get a file

If you remove Response.AddHeader "Content-Length", RS ("File_SIZE") response.addheader "Content-Disposition", "Attachment; FileName =" "" "also can display pictures Gets the file will be saved with getfile.asp because there is no specified file name.


New Post(0)