De nuevo downLoadFile

20/01/2004 - 16:37 por Mario Cassanelli | Informe spam
El codigo lo obtuve en este foro, como prodran ver no cambie nada..., o creo
que casi nada..., al final esta lo que sale
mezcla de HTML y el archivo csv, estoy buscando en el help de visual
interdev, para entender el codigo

Gracias
Saludos
Mario


<body bgcolor="#FFFFFF" text="#000000">
<%
DIM FICHERO
DIM strPATH

FICHERO = request.QUERYSTRING("nombre")
strPATH="vt_ventas"

'RESPONSE.WRITE "<br>" & fichero & "<br>" & strPATH
'RESPONSE.WRITE "<br>" & Server.Mappath(strPath & "/" & fichero)

response.contentType = "application/x-unknow"
response.addHeader "Content-Disposition","fattachment; filename=" & chr(34)
& fichero & chr(34)
response.BinaryWrite getBinaryFile( Server.Mappath(strPath & "/" &
fichero) )

function getBinaryFile(fileSpec)
Dim adTypeBinary
Dim oStream
adTypeBinary = 1
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile = oStream.read
set oStream = Nothing
end function
%>

</body>



<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
.
.
.
22/12/2003,83,JUAN JOSE,EFECTIVO,CF , ,B -330, 23.55,21.00, 4.95,0.00,
0.00, 0.00, 0.00, 28.50,ACAZON, , , , , , , ,
22/12/2003,367,GRAICELA HILDA,EFECTIVO,CF , ,B -337, 15.70,21.00,
3.30,0.00, 0.00, 0.00, 0.00, 19.00,ACAZON, , , , , , ,
,
.
.
.


</body>
</html>

Preguntas similare

Leer las respuestas

#1 Miguel González
20/01/2004 - 17:38 | Informe spam
Prueba a quitarle al código los "tags" html que lo envuelven ("<html>" etc.) y no hagas el response.write de texto.

La página quedaría limpia y pelada mas o menos así:

<%
DIM FICHERO
DIM strPATH

Function getBinaryFile(fileSpec)
Dim adTypeBinary
Dim oStream
adTypeBinary = 1
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile = oStream.read
set oStream = Nothing
End function

fichero = request.QUERYSTRING("nombre")
strPATH="vt_ventas"
response.contentType = "application/x-unknow"
response.addHeader "Content-Disposition","fattachment; filename=" & chr(34) & fichero & chr(34)
response.BinaryWrite getBinaryFile( Server.Mappath(strPath & "/" & fichero) )
%>

Saludos!
Miguel


"Mario Cassanelli" escribió en el mensaje news:eP4%
El codigo lo obtuve en este foro, como prodran ver no cambie nada..., o creo
que casi nada..., al final esta lo que sale
mezcla de HTML y el archivo csv, estoy buscando en el help de visual
interdev, para entender el codigo

Gracias
Saludos
Mario


<body bgcolor="#FFFFFF" text="#000000">
<%
DIM FICHERO
DIM strPATH

FICHERO = request.QUERYSTRING("nombre")
strPATH="vt_ventas"

'RESPONSE.WRITE "<br>" & fichero & "<br>" & strPATH
'RESPONSE.WRITE "<br>" & Server.Mappath(strPath & "/" & fichero)

response.contentType = "application/x-unknow"
response.addHeader "Content-Disposition","fattachment; filename=" & chr(34)
& fichero & chr(34)
response.BinaryWrite getBinaryFile( Server.Mappath(strPath & "/" &
fichero) )

function getBinaryFile(fileSpec)
Dim adTypeBinary
Dim oStream
adTypeBinary = 1
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile = oStream.read
set oStream = Nothing
end function
%>

</body>



<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
.
.
.
22/12/2003,83,JUAN JOSE,EFECTIVO,CF , ,B -330, 23.55,21.00, 4.95,0.00,
0.00, 0.00, 0.00, 28.50,ACAZON, , , , , , , ,
22/12/2003,367,GRAICELA HILDA,EFECTIVO,CF , ,B -337, 15.70,21.00,
3.30,0.00, 0.00, 0.00, 0.00, 19.00,ACAZON, , , , , , ,
,
.
.
.


</body>
</html>


Respuesta Responder a este mensaje
#2 Mario Cassanelli
20/01/2004 - 20:43 | Informe spam
Gracias MIL MIGUEL, todo bien, salio perfecto ..., mi error es de concepto,
al dejarle los tags html,
se incluyen en el archivo de salida, lo cual lo convierte en un archivo
cuasi csv, al importalo sobre
todo el excel 2000 no lo reconoce, el excel 97 si e incluye los tags de
html.

El error de concepto es una pagina en asp no necesariamente debe contener
tags de html...!

Un saludo
Mario Cassanelli
Argentina

"Miguel González" escribió en el mensaje
news:ehEx%
Prueba a quitarle al código los "tags" html que lo envuelven ("<html>" etc.)
y no hagas el response.write de texto.

La página quedaría limpia y pelada mas o menos así:

<%
DIM FICHERO
DIM strPATH

Function getBinaryFile(fileSpec)
Dim adTypeBinary
Dim oStream
adTypeBinary = 1
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile = oStream.read
set oStream = Nothing
End function

fichero = request.QUERYSTRING("nombre")
strPATH="vt_ventas"
response.contentType = "application/x-unknow"
response.addHeader "Content-Disposition","fattachment; filename=" & chr(34)
& fichero & chr(34)
response.BinaryWrite getBinaryFile( Server.Mappath(strPath & "/" &
fichero) )
%>

Saludos!
Miguel


"Mario Cassanelli" escribió en el mensaje
news:eP4%
El codigo lo obtuve en este foro, como prodran ver no cambie nada..., o


creo
que casi nada..., al final esta lo que sale
mezcla de HTML y el archivo csv, estoy buscando en el help de visual
interdev, para entender el codigo

Gracias
Saludos
Mario


<body bgcolor="#FFFFFF" text="#000000">
<%
DIM FICHERO
DIM strPATH

FICHERO = request.QUERYSTRING("nombre")
strPATH="vt_ventas"

'RESPONSE.WRITE "<br>" & fichero & "<br>" & strPATH
'RESPONSE.WRITE "<br>" & Server.Mappath(strPath & "/" & fichero)

response.contentType = "application/x-unknow"
response.addHeader "Content-Disposition","fattachment; filename=" &


chr(34)
& fichero & chr(34)
response.BinaryWrite getBinaryFile( Server.Mappath(strPath & "/" &
fichero) )

function getBinaryFile(fileSpec)
Dim adTypeBinary
Dim oStream
adTypeBinary = 1
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile = oStream.read
set oStream = Nothing
end function
%>

</body>



<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
.
.
.
22/12/2003,83,JUAN JOSE,EFECTIVO,CF , ,B -330, 23.55,21.00,


4.95,0.00,
0.00, 0.00, 0.00, 28.50,ACAZON, , , , , , , ,
22/12/2003,367,GRAICELA HILDA,EFECTIVO,CF , ,B -337, 15.70,21.00,
3.30,0.00, 0.00, 0.00, 0.00, 19.00,ACAZON, , , , , , ,
,
.
.
.


</body>
</html>


Respuesta Responder a este mensaje
#3 Jhonny Vargas P.
20/01/2004 - 21:21 | Informe spam
Hola Mario,

Solo una cosa, para la otra que necesites ayuda no envíes tantos mensajes
con lo mismo, solo deja uno y de este desprende sub-mensajes... bueno es
solo eso y espero que no lo tomes a mal.

Saludos,
Jhonny Vargas P. [MS-MVP]
Santiago de Chile
http://www.mvp.cl





"Mario Cassanelli" escribió en el mensaje
news:
Gracias MIL MIGUEL, todo bien, salio perfecto ..., mi error es de


concepto,
al dejarle los tags html,
se incluyen en el archivo de salida, lo cual lo convierte en un archivo
cuasi csv, al importalo sobre
todo el excel 2000 no lo reconoce, el excel 97 si e incluye los tags de
html.

El error de concepto es una pagina en asp no necesariamente debe contener
tags de html...!

Un saludo
Mario Cassanelli
Argentina

"Miguel González" escribió en el mensaje
news:ehEx%
Prueba a quitarle al código los "tags" html que lo envuelven ("<html>"


etc.)
y no hagas el response.write de texto.

La página quedaría limpia y pelada mas o menos así:

<%
DIM FICHERO
DIM strPATH

Function getBinaryFile(fileSpec)
Dim adTypeBinary
Dim oStream
adTypeBinary = 1
set oStream = server.createobject("ADODB.Stream")
oStream.Open
oStream.Type = adTypeBinary
oStream.LoadFromFile fileSpec
getBinaryFile = oStream.read
set oStream = Nothing
End function

fichero = request.QUERYSTRING("nombre")
strPATH="vt_ventas"
response.contentType = "application/x-unknow"
response.addHeader "Content-Disposition","fattachment; filename=" &


chr(34)
& fichero & chr(34)
response.BinaryWrite getBinaryFile( Server.Mappath(strPath & "/" &
fichero) )
%>

Saludos!
Miguel


"Mario Cassanelli" escribió en el mensaje
news:eP4%
> El codigo lo obtuve en este foro, como prodran ver no cambie nada..., o
creo
> que casi nada..., al final esta lo que sale
> mezcla de HTML y el archivo csv, estoy buscando en el help de visual
> interdev, para entender el codigo
>
> Gracias
> Saludos
> Mario
>
>
> <body bgcolor="#FFFFFF" text="#000000">
> <%
> DIM FICHERO
> DIM strPATH
>
> FICHERO = request.QUERYSTRING("nombre")
> strPATH="vt_ventas"
>
> 'RESPONSE.WRITE "<br>" & fichero & "<br>" & strPATH
> 'RESPONSE.WRITE "<br>" & Server.Mappath(strPath & "/" & fichero)
>
> response.contentType = "application/x-unknow"
> response.addHeader "Content-Disposition","fattachment; filename=" &
chr(34)
> & fichero & chr(34)
> response.BinaryWrite getBinaryFile( Server.Mappath(strPath & "/" &
> fichero) )
>
> function getBinaryFile(fileSpec)
> Dim adTypeBinary
> Dim oStream
> adTypeBinary = 1
> set oStream = server.createobject("ADODB.Stream")
> oStream.Open
> oStream.Type = adTypeBinary
> oStream.LoadFromFile fileSpec
> getBinaryFile = oStream.read
> set oStream = Nothing
> end function
> %>
>
> </body>
>
>
>
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000">
> .
> .
> .
> 22/12/2003,83,JUAN JOSE,EFECTIVO,CF , ,B -330, 23.55,21.00,
4.95,0.00,
> 0.00, 0.00, 0.00, 28.50,ACAZON, , , , , , , ,
> 22/12/2003,367,GRAICELA HILDA,EFECTIVO,CF , ,B -337, 15.70,21.00,
> 3.30,0.00, 0.00, 0.00, 0.00, 19.00,ACAZON, , , , , ,


,
> ,
> .
> .
> .
>
>
> </body>
> </html>
>
>


email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida