RE:Subir archivos al servidor
Adapta ersta funcion, recibe como parametro un textbox typo file, y al guardar el FSO solo especifica la ruta
'creamos el arreglo de 100
Dim x(100)
server.scripttimeout = 30000
ForWriting = 2
adLongVarChar =201
lngNumberUploaded = 0
noBytes = Request.TotalBytes
binData = Request.BinaryRead (noBytes)
Set RST = CreateObject("ADODB.Recordset")
LenBinary = LenB(binData)
if LenBinary > 0 Then
RST.Fields.Append "myBinary", adLongVarChar, LenBinary
RST.Open
RST.AddNew
RST("myBinary").AppendChunk BinData
RST.Update
strDataWhole = RST("myBinary")
End if
strBoundry = Request.ServerVariables ("HTTP_CONTENT_TYPE")
lngBoundryPos = instr(1,strBoundry,"boundary=") + 9
strBoundry = "--" & right(strBoundry,len(strBoundry)-lngBoundryPos)
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
Do While lngCurrentEnd > 0
strData = mid(strDataWhole,lngCurrentBegin, lngCurrentEnd - lngCurrentBegin)
strDataWhole = replace(strDataWhole,strData,"")
lngBeginFileName = instr(1,strdata,"filename=") + 10
lngEndFileName = instr(lngBeginFileName,strData,chr(34))
if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 Then
'response.redirect "ups.asp"
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>"
End if
if lngBeginFileName <> lngEndFileName Then
strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)
tmpLng = instr(1,strFilename,"\")
Do While tmpLng > 0
PrevPos = tmpLng
tmpLng = instr(PrevPos + 1,strFilename,"\")
Loop
FileName = right(strFilename,len(strFileName) - PrevPos)
lngCT = instr(1,strData,"Content-Type:")
if lngCT > 0 Then
lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4
Else
lngBeginPos = lngEndFileName
End if
lngEndPos = len(strData)
lngDataLenth = lngEndPos - lngBeginPos
strFileData = mid(strData,lngBeginPos,lngDataLenth)
comple=trim(session("carpeta"))
Cvar=Filename
'creación del objeto FSO
Set fso = CreateObject("Scripting.FileSystemObject")
'Set f = fso.OpenTextFile (server.mappath(".") & "/"&comple&"/" &_
response.write server.mappath(".") &"\"& FileName
Set f = fso.OpenTextFile (server.mappath(".") &"\"& FileName, ForWriting, True)
f.Write strFileData
lista=0
'For Each file in f
'For Each file in f
'lista = lista+1
'x(lista) = file.FileName
'Next
'response.write(x(file) & "<br>")
Set f = nothing
Set fso = nothing
lngNumberUploaded = lngNumberUploaded + 1
End if
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
loop
Response.Write " El archivo ha sido enviado exitosamente.<BR>"
Response.Write "<BR><BR><INPUT type='button' onclick='document.location=" & chr(34) & "ups.asp" & chr(34) & "' value='<< Volver' id='button'1 name='button'1>"
End Select