ASP - aspupload

 
Vista:

aspupload

Publicado por igartzi (8 intervenciones) el 03/03/2006 11:44:06
Hola al foro!!
estoy creando una aplicación de inmobiliarias, con 3 opciones en la maquinaria, insertar, modificar y borrar. Insertar y borrar me funciona correctamente, pero modificar no lo consigo.

Este código me funciona bien simpre y cuando los campos imagen 1, imagen2, imagen 3 esten seleccionados, lo que quiero es que si el usuario no selecciona nada se quede con la imagen actual ya que no siempre querra modificar todas las imagenes.

Un saludo.
Espero que me puedan ayudar.

<%

Set Upload = Server.CreateObject("Persits.Upload")

Path2 = Server.MapPath("../images/venta/fotosg")

Path3 = Server.MapPath("../images/venta/fotos")

Path =Server.MapPath("../images/fotos")


count = Upload.Save(Path)

If count = 0 Then
Response.Write "Falta alguna imagen por insertar."
Response.End
else
If count = 1 Then
Response.Write "Falta alguna imagen por insertar."
Response.End
Else
If count = 2 Then
Response.Write "Falta alguna imagen por insertar."
Response.End
Else


Set File1 = Upload.Files("imagen1")
Set File2 = Upload.Files("imagen2")
Set File3 = Upload.Files("imagen3")


Set jpeg1 = Server.CreateObject("Persits.Jpeg")
Set jpeg2 = Server.CreateObject("Persits.Jpeg")
Set jpeg3 = Server.CreateObject("Persits.Jpeg")

Set jpeg4 = Server.CreateObject("Persits.Jpeg")
Set jpeg5 = Server.CreateObject("Persits.Jpeg")
Set jpeg6 = Server.CreateObject("Persits.Jpeg")

jpeg1.Open( File1.Path )
jpeg2.Open( File2.Path )
jpeg3.Open( File3.Path )

jpeg4.Open( File1.Path )
jpeg5.Open( File2.Path )
jpeg6.Open( File3.Path )


Jpeg1.Width = Jpeg1.OriginalWidth / 2
Jpeg1.Height = Jpeg1.OriginalHeight / 2

Jpeg2.Width = Jpeg2.OriginalWidth / 2
Jpeg2.Height = Jpeg2.OriginalHeight / 2

Jpeg3.Width = Jpeg3.OriginalWidth / 2
Jpeg3.Height = Jpeg3.OriginalHeight / 2

Jpeg4.Width = Jpeg4.OriginalWidth / 4
Jpeg4.Height = Jpeg4.OriginalHeight / 4

Jpeg5.Width = Jpeg5.OriginalWidth / 4
Jpeg5.Height = Jpeg5.OriginalHeight / 4

Jpeg6.Width = Jpeg6.OriginalWidth / 4
Jpeg6.Height = Jpeg6.OriginalHeight / 4

SavePath1 = Path2 & "\" & File1.ExtractFileName
SavePath2 = Path2 & "\" & File2.ExtractFileName
SavePath3 = Path2 & "\" & File3.ExtractFileName

SavePath4 = Path3 & "\" & File1.ExtractFileName
SavePath5 = Path3 & "\" & File2.ExtractFileName
SavePath6 = Path3 & "\" & File3.ExtractFileName

If UCase(Right(SavePath1, 3)) <> "JPG" Then
SavePath1 = SavePath1 & ".jpg"
End If

If UCase(Right(SavePath2, 3)) <> "JPG" Then
SavePath2 = SavePath2 & ".jpg"
End If

If UCase(Right(SavePath3, 3)) <> "JPG" Then
SavePath3 = SavePath3 & ".jpg"
End If

If UCase(Right(SavePath4, 3)) <> "JPG" Then
SavePath4 = SavePath4 & ".jpg"
End If

If UCase(Right(SavePath5, 3)) <> "JPG" Then
SavePath5 = SavePath5 & ".jpg"
End If

If UCase(Right(SavePath6, 3)) <> "JPG" Then
SavePath6 = SavePath6 & ".jpg"


end if


jpeg1.Save SavePath1
jpeg2.Save SavePath2
jpeg3.Save SavePath3
jpeg4.Save SavePath4
jpeg5.Save SavePath5
jpeg6.Save SavePath6

%>

<%

Set fs = Server.CreateObject("Scripting.FileSystemObject")



if fs.FileExists("d:\xvrt\dominio\html\maqueta/images/fotos/" & File1.Filename) then fs.DeleteFile("d:\xvrt\dominio\html\maqueta/images/fotos/" & File1.Filename)

if fs.FileExists("d:\xvrt\dominio\html\maqueta/images/fotos/" & File2.Filename) then fs.DeleteFile("d:\xvrt\dominio\html\maqueta/images/fotos/" & File2.Filename)

if fs.FileExists("d:\xvrt\dominio\html\maqueta/images/fotos/" & File3.Filename) then fs.DeleteFile("d:\xvrt\dominio\html\maqueta/images/fotos/" & File3.Filename)

Set fs = Nothing
%>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:aspupload

Publicado por gabriel brancolini (9 intervenciones) el 08/03/2006 21:36:18
for i=1 to 3
if lenght(cstr(upload.files(i).value))=0 then
'este no tiene nada asi que sale
HacerAlgo=false
exit for
else
HacerAlgo=true
end if
next

sino con un foreach asi lo haces mas extensible que a 3 files.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar