Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Gilberto Jr

Donlowad Arquivo TXT

Recommended Posts

Boa noite;

 

Eu estou com problema na hora de fazer o download de um arquivo txt.

 

Eu faço o upload do arquivo sem problema. Só que na hora que eu faço o download do arquivo o mesmo vem com varias linhas de erro dentro dele.

 

O arquivo vem assim

 
<!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>
<!--Inicio Google Analitics-->
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
 
  ga('create', 'UA-42576347-1', 'tecnogalli.com.br/consultoria');
  ga('send', 'pageview');
 
</script>
<!--Fim Google Analitics-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>68600.TXT</title>
</head>
<a href="arquivos/MISSBELLA/MissbellaShoppingVitoria/68600.TXT"></a>
<body>
 
7909179183503,1,14980
7909179183527,1,14980
7909179199580,2,5480
7909179199597,2,5480
7909179199603,1,5480
7909179199610,1,5480
7909179202983,1,13980
7909179202990,1,13980
7909179203003,1,13980
 
</body>
</html>
 <font face="Arial" size=2>
<p>Response object</font> <font face="Arial" size=2>error 'ASP 0156 : 80004005'</font>
<p>
<font face="Arial" size=2>Header Error</font>
<p>
<font face="Arial" size=2>/consultoria/download3.asp</font><font face="Arial" size=2>, line 105</font>
<p>
<font face="Arial" size=2>The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
</font>

O informação que eu preciso é somente isso

7909179183503,1,14980
7909179183527,1,14980
7909179199580,2,5480
7909179199597,2,5480
7909179199603,1,5480
7909179199610,1,5480
7909179202983,1,13980
7909179202990,1,13980
7909179203003,1,13980

o Codigo que estou usando é

Response.Buffer = True
Response.AddHeader "Content-Type","application/octet-stream"
Response.AddHeader "Content-Disposition","attachment; filename="&request.QueryString("nf")&""
Response.Flush
 
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile Server.MapPath("arquivos/"&pathrede&"/"&pathloja&"/"&request.QueryString("nf")&"")
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Response.Flush

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom dia;

 

Consegui resolver. Usei esse código tirando todas as tags html.

dim objStream
set objStream = server.createObject("ADODB.Stream")
with (response)
.buffer = true  
.addHeader "Content-Type","application/x-msdownload"
.addHeader "Content-Disposition","attachment; filename="&rs("arquivo")  
.flush  
end with
with (objStream)
.open  
.type = 1  
.loadFromFile server.mapPath("arquivos/"&pathrede&"/"&pathloja&"/"&rs("arquivo"))
end with
response.binaryWrite objStream.read
set objStream = nothing
response.flush

 

Só que a DATA: ANO-MES-DIA E A HORA: HORA-MINUTO-SEGUNDO esta indo na primeira linha do arquivo.

 

como eu faço para tirar?

 

Att;

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.