call download(server.mappath("./test.jpg")) Function download(File) temp = Split(File, "") filename = temp(UBound(temp)) Set s = CreateObject("adodb.stream") s.mode = 3 s.Type = 1 s.Open s.loadfromfile(File) data = s.Read If IsNull(data) Then response.Write "空" Else response.Clear Response.ContentType = "application/octet-stream" Response.AddHeader "Content-Disposition", "attachment; filename=" & filename response.binarywrite(data) End If Set s = Nothing End Function
(责任编辑:admin) |