Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/08/2008, 09:04
Avatar de OceanBorn
OceanBorn
 
Fecha de Ingreso: agosto-2008
Mensajes: 7
Antigüedad: 16 años, 8 meses
Puntos: 0
Error en Upload ASP

Hola Amigos de esta comunidad,
tengo un problema en un upload que hago en asp, para subir archivos, yo quiero que me los renombre al subir y estoy trabajando con esto y pasare a mostrarles el problema que me surge:

formulario.aspx
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="C#" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sin título 1</title>
</head>

<body>

<form name="form1" method="post" ENCTYPE="multipart/form-data" ACTION="Upload.asp">
<p>
<INPUT TYPE=FILE SIZE=60 NAME="FILE1">
</p>
<p>&nbsp; </p>
<p><BR>
<INPUT TYPE=SUBMIT VALUE="Upload!"> 

</p>
</FORM>
</body>

</html>
upload.asp
Código:
<html>
<head>
<title>Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.style1 {
	color: #FFFFFF;
}
</style>
</head>

<body style="background-color: #605148">
<%
Set Upload = Server.CreateObject("Persits.Upload.1")
Count= Upload.Save("AGREGO CARPETA DEL FTP DEL SITIO CON SUS RESPECTIVOS PERMISOS")
%>
<% = Count %> ficheros subidos.
<% 
Dim FSO, Fich , NombreAnterior, NombreNuevo 
'Inicialización
NombreAnterior = imagen
NombreNuevo ="Nuevo.jpg" 

' Instanciamos el objeto
Set FSO = Server.CreateObject("Scripting.FileSystemObject") 
' Asignamos el fichero a renombrar a la variable fich
Set Fich = FSO.GetFile(Server.MapPath("EN ESTE PASO TENGO DUDAS, PONGO LA MISMA CARPETA DEL SITIO DEL UPLOAD.SAVE" & NombreAnterior)) 
' llamamos a la funcion copiar, 
'y duplicamos el archivo pero con otro nombre
Call Fich.Copy(Server.MapPath("LA MISMA CARPETA" & NombreNuevo)) 
' finalmente borramos el fichero origi nal
Call Fich.Delete() 

Set Fich = Nothing 
Set FSO = Nothing 


%>
<%
Set Upload = Nothing
%>
<a href="index.html"><span class="style1">Continuar
</span></a>
</body>
</html>
Al trata de subir el archivo, el explorer me visualiza este error:

1 ficheros subidos.
Server.MapPath() error 'ASP 0172 : 80004005'

Invalid Path

/without_flash/Upload_new.asp, line 27

The Path parameter for the MapPath method must be a virtual path. A physical path was used.


la line 27 que especifica, es:
Set Fich = FSO.GetFile(Server.MapPath("EN ESTE PASO TENGO DUDAS, PONGO LA MISMA CARPETA DEL SITIO DEL UPLOAD.SAVE" & NombreAnterior)).

Si alguien me podria ayudar en esto, se lo agradeceria.

Saludos.