Ver Mensaje Individual
  #3 (permalink)  
Antiguo 25/06/2002, 02:30
Avatar de epa2
epa2
 
Fecha de Ingreso: abril-2002
Ubicación: Málaga
Mensajes: 1.475
Antigüedad: 22 años, 1 mes
Puntos: 9
Re: script upload

y continua.......

'Get the full path of the current file.
lngBeginFileName = instr(1,strdata,"filename=") + 10
lngEndFileName = instr(lngBeginFileName,strData,chr(34))
'Make sure they selected at least one fi
' le.
if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 Then

Response.Write "<H2> Ha ocurrido el siguiente error.</H2>"
Response.Write "Debes elegir un archivo para subir"
Response.Write "<BR><BR>Pulsa el botón volver, realiza la corrección."
Response.Write "<BR><BR><INPUT type='button' onclick='history.go(-1)' value='<< Volver' id='button'1 name='button'1>"
Response.End
End if
'There could be one or more empty file b
' oxes.
if lngBeginFileName <> lngEndFileName Then
strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)
'Creates a raw data file with data betwe
' en current boundrys. Uncomment for debug
' ing.
'Set fso = CreateObject("Scripting.FileSystemObject&quot ;)
'Set f = fso.OpenTextFile(server.mappath(".") & "\raw_" & lngNumberUploaded & ".txt", ForWriting, True)
'f.Write strData
'set f = nothing
'set fso = nothing

'Loose the path information and keep jus
' t the file name.
tmpLng = instr(1,strFilename,"\")
Do While tmpLng > 0
PrevPos = tmpLng
tmpLng = instr(PrevPos + 1,strFilename,"\")
Loop

FileName = right(strFilename,len(strFileName) - PrevPos)

'Get the begining position of the file d
' ata sent.
'if the file type is registered with the
' browser then there will be a Content-Typ
' e
lngCT = instr(1,strData,"Content-Type:")

if lngCT > 0 Then
lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4
Else
lngBeginPos = lngEndFileName
End if
'Get the ending position of the file dat
' a sent.
lngEndPos = len(strData)

'Calculate the file size.
lngDataLenth = lngEndPos - lngBeginPos
'Get the file data
strFileData = mid(strData,lngBeginPos,lngDataLenth)
'Create the file.
Set fso = CreateObject("Scripting.FileSystemObject&quot ;)
Set f = fso.OpenTextFile(server.mappath("..") & "\TuDirectorio\" &_
FileName, ForWriting, True)
f.Write strFileData
Set f = nothing
Set fso = nothing

lngNumberUploaded = lngNumberUploaded + 1

End if

'Get then next boundry postitions if any
' .
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
loop


Response.Write "Archivo subido"
Response.Write lngNumberUploaded & " archivo ya está en el servidor.<BR>"
Response.Write "<BR><BR><INPUT type='button' onclick='document.location=" & chr(34) & "saveany.asp" & chr(34) & "' value='<< Volver' id='button'1 name='button'1>"
End Select
%>
</BODY>
</HTML>


<html>
<body>
<p align="left"><font color="#FF0000" face="Comic Sans MS" size="2">Aprendiz
de todo y maestro de nada[/CODE]
</p>
</body>
</html>