Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/12/2006, 14:06
bitshoot
 
Fecha de Ingreso: noviembre-2004
Mensajes: 371
Antigüedad: 20 años, 5 meses
Puntos: 0
Re: Recorrer fichero de texto

puedes adaptar este codigo... hace lo que quieres pero recibiendo el archivo txt desde un formulario... y el archivo es un txt exportado de excel separado con comas... por eso lo del chr(algo...44) modificalo como quieras ya que te recorre por linea y por campo (separacion por comas...) espero te sirva. suerte.

<%
set objUpload = new xelUpload
objUpload.Upload()

buscaLinea = 0

set objFich1 = objUpload.Ficheros("input_recive_archivo")
objFich1.Guardar Server.MapPath(".")
Aux_imagen = objFich1.Nombre

Set fso = CreateObject("Scripting.FileSystemObject")
Set textStreamObject = fso.OpenTextFile(Server.Mappath(".") & "\"&Aux_imagen&"",1,false,0)
'"
if not textStreamObject.AtendOfStream then
while not textStreamObject.AtendOfStream
arreglo = split(textStreamObject.Readline, chr(44))
buscaLinea = buscaLinea + 1
for i = 0 to ubound(arreglo)
if buscaLinea = 2 then
buscaCampo = i
if buscaCampo = 1 then

response.write(arreglo(i)) & "<br>"
end if
end if
next

wend
Set textStreamObject = Nothing
Set fso = Nothing
end if
%>