ASP no component download source code

xiaoxiao2021-03-06  34

Response.buffer = TRUE

Set S = Server.createObject ("AdoDb.Stream")

S.Open

S.TYPE = 1

SET FSO = Server.createObject ("scripting.filesystemObject")

if fso.fileexists (strfilename) THEN

Set f = fso.getfile (strfilename)

IntfileLength = f.size

S.LoadFromFile (StrfileName)

Response.addheader "Content-Disposition", "Attachment; filename =" & f.name

Response.addheader "Content-Length", Intfilelength

Response.contentType = "Application / OcTet-stream"

Response.Charset = "UTF-8"

Response.binaryWrite S.Read

Response.flush

S.close (strfilename)

S.Close

SET S = Nothing

Downloading this code will pop up a web page, and cannot be automatically closed, the solution is to set up a frame, let the height of this frame is 0, then that the webpage does not show up.

转载请注明原文地址:https://www.9cbs.com/read-61761.html

New Post(0)