public function download(arquivo, pasta)
dim objStream
set objStream = server.createObject("ADODB.Stream")
with (response)
.buffer = true
.addHeader "Content-Type","application/x-msdownload"
.addHeader "Content-Disposition","attachment; filename="&arquivo
.flush
end with
with (objStream)
.open
.type = 1
.loadFromFile server.mapPath(pasta)
end with
response.binaryWrite objStream.read
set objStream = nothing
response.flush
end function
Pergunta
Ted k'
Função Criada...
public function download(arquivo, pasta) dim objStream set objStream = server.createObject("ADODB.Stream") with (response) .buffer = true .addHeader "Content-Type","application/x-msdownload" .addHeader "Content-Disposition","attachment; filename="&arquivo .flush end with with (objStream) .open .type = 1 .loadFromFile server.mapPath(pasta) end with response.binaryWrite objStream.read set objStream = nothing response.flush end functionpara chamar a função...<a href="<% call download("arquivo.pdf", "pasta") %>">baixe aqui</a>Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.