E:
/
home
/
kbcomunicacao1
/
Web
/
Upload File
HOME
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <!-- #include file ="conexao.asp" --> <% 'É necessário passar o nome do arquivo no FORM id = Request("id") set recFoto = server.CreateObject( "ADODB.recordset") SQL = "SELECT id, thumb, foto FROM imagens WHERE id="&id recFoto.open SQL, conbanco Arquivo = recFoto("foto") recFoto.close set recFoto = nothing Response.Buffer = True Response.AddHeader "Content-Type","application/x-msdownload" Response.AddHeader "Content-Disposition","attachment; filename=" & Arquivo Response.Flush Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = 1 objStream.LoadFromFile Server.MapPath(Arquivo) Response.BinaryWrite objStream.Read objStream.Close Set objStream = Nothing Response.Flush %> </body> </html>