Foros del Web » Programando para Internet » ASP Clásico »

asp upload, me cambia el path¿¿??

Estas en el tema de asp upload, me cambia el path¿¿?? en el foro de ASP Clásico en Foros del Web. hola tengo un server upload y no me tira error pero antes de hacer un upload para ver las fotos ya cargadas utiliso ../y el ...
  #1 (permalink)  
Antiguo 16/04/2008, 11:50
 
Fecha de Ingreso: marzo-2008
Mensajes: 25
Antigüedad: 17 años, 1 mes
Puntos: 0
asp upload, me cambia el path¿¿??

hola tengo un server upload y no me tira error pero antes de hacer un upload para ver las fotos ya cargadas utiliso ../y el path de carpetas hasta la imagen

despues de hacer el upload me toma una carpeta mas abajo por asi decirlo y deberia sacarle el ../ para que me encuentre la imagen? que puede ser o como se puede solucionar?

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Create C:\FooBar
If Not objFSO.FolderExists(Server.MapPath("../img/proyectos/promo" & txtid)) then
objFSO.CreateFolder(Server.MapPath("../img/proyectos/promo" & txtid &""))
objFSO.CreateFolder(Server.MapPath("../img/proyectos/promo" & txtid &"/fotos"))
objFSO.CreateFolder(Server.MapPath("../img/proyectos/promo" & txtid &"/planos"))
set objFSO = nothing
End If
ForWriting = 2
adLongVarChar = 201
lngNumberUploaded = 0

'Get binary data from form
noBytes = Request.TotalBytes
binData = Request.BinaryRead (noBytes)
'convery the binary data to a string
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=") + 8
strBoundry = "--" & right(strBoundry,len(strBoundry)-lngBoundryPos)
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
if lngCurrentEnd > 0 then
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
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
'Get the file data
strFileData = mid(strData,lngBeginPos,lngDataLenth)
'nombre del archivo y datos para la base
strSQLI="UPDATE URWT_PROMOCIONES set PRO_DIRECTORIO='../img/proyectos/promo" & txtid & "/', PRO_ULTIMA = '" & ultima + 1 &"' Where PRO_CODPRO="& txtid
Conexion.BeginTrans()
Conexion.Execute(strSQLI)
Conexion.CommitTrans()
'Crear descripcion

strSQLI2="Insert Into URWT_IMAGENES (PRO_NOMBRE, PRO_CODPRO, PRO_ID) VALUES ('foto"&ultima + 1&"', "&txtid&", "&ultima + 1&")"
Conexion.BeginTrans()
Conexion.Execute(strSQLI2)
Conexion.CommitTrans()

'Create the file.
Set fso = Server.CreateObject("Scripting.FileSystemObject")
FileN = ".jpg"
Set f = fso.OpenTextFile(Server.MapPath("../img/proyectos/promo" & txtid &"/fotos/foto")& ultima + 1 & FileN, 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
end if
'Conexion a la BD "Access"
Dim Conex
Set Conex = Server.CreateObject ("ADODB.Connection")
Conex.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("../../../data/Urnova2.mdb")
'inserto en galeria de fotos
'strSQL="INSERT INTO URWT_PROMOCIONES (IDPropiedad,PRO_DIRECTORIO) VALUES ("& id &",'"& FileName &"')"
'Conex.BeginTrans()
'Conex.Execute(strSQL)
'Conex.CommitTrans()
promo = "La Promocion se guardo correctamente. Seleccione otra opcion para subir un archivo"
response.Redirect("imagenes2.asp?txtid="&txtid&"&f oto="&ultima + 1)
  #2 (permalink)  
Antiguo 16/04/2008, 12:37
Avatar de Myakire
Colaborador
 
Fecha de Ingreso: enero-2002
Ubicación: Centro de la república
Mensajes: 8.849
Antigüedad: 23 años, 3 meses
Puntos: 146
Re: asp upload, me cambia el path¿¿??

Solo por curiosidad ....

¿por qué no usas rutas absolutas?, ¿no te es más sencillo que esta lideando con tantos ../?
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:56.