Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/09/2004, 02:55
Avatar de Joselete
Joselete
 
Fecha de Ingreso: septiembre-2001
Ubicación: Granada, España
Mensajes: 263
Antigüedad: 23 años, 7 meses
Puntos: 0
Ayuda urgente con ruta de directorio UPLOAD

Hola!!

Mi web funciona perfectamente en Local, la subida de archivos, el envio de correo, etc... todo perfecto!!!.

En local uso el archivo conexion.asp q es:

<!--#include file="cadenaconexion.asp"-->
<%


rutafichero = "ficheros\"
rutaraiz = "C:\Inetpub\wwwroot\FINAL\"
rutafoto= "C:\Inetpub\wwwroot\FINAL\"
rutafotosAlta="C:\Inetpub\wwwroot\FINAL\web\Fotos\ "

%>
<script language="JavaScript">
function nuevaventana1 (pagina,a,b)
{
open(pagina,"nueva1","toolbar=no,directories=no,sc rollbars=yes,menubar=no,resizable=yes,width=" + a + ",height=" +b);
}

</script>


Bien, el formulario de subida de fotos formfichero.asp, q es:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Subida de ficheros</title>
<style>
#precarga{
position:absolute;
width:100%;
height:100%;
top:0;
left:0;
bgcolor: #E4e7ee;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
background-color: #E4e7ee;
visibility: hidden;
}
</style>
<link rel="stylesheet" href="../style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
</head>

<body bgcolor="#E4e7ee">
<form name="formulario" action="grabafichero.asp" method="post" enctype="multipart/form-data">
<div id="precarga">
<center><h3><br>Cargando, espere por favor...</h3></center></div>
<table width="96%" border="0" cellspacing="0" cellpadding="0" bgcolor="#E4e7ee" class="normal">
<tr>
<td width="44%">Seleccione el fichero a subir:</td>
<td width="56%"><input name="fichero" type="file" class="normal"></td>
</tr>
<tr>
<td>&nbsp;</td>
<input type="hidden" name="idvehiculo" value="<%=request.QueryString("id")%>">
<td><input type="submit" name="submit" value="Subir Foto" onClick="MM_showHideLayers('precarga','','show')" class="normal"></td>
</tr>
</table>

</form>
</body>
</html>


el archivo grabafichero.asp al q hace referencia es:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<!--#include file="xelupload.asp"-->
<!--#include file="conexion.asp"-->
<title>Subida de ficheros</title>
<link rel="stylesheet" href="../style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#E4e7ee">
<div align="center" class="normal">
<p class="normal">
<%
set rsFotosFichero = server.CreateObject("adodb.recordset")
rsFotosFichero.CursorType = 1
rsFotosFichero.CursorLocation= 3
rsFotosFichero.LockType =3
'para subir el fichero
Dim objUpload, objFich, strNombreFichero
Dim strNombre, strEdad

'Creamos el objeto
set objUpload = new xelUpload

'Recibimos el formulario
objUpload.Upload()

'Mostramos total de ficheros recibidos


'Y ahora mostramos los datos del fichero enviado:
'Lo sacamos a una variable por comodidad
set objFich = objUpload.Ficheros("fichero")



'Guardamos el fichero, con su nombre, en el directorio
'en el que se encuentra esta página
'response.Write(Server.MapPath("/upload"))
objFich.Guardar(Server.MapPath("/upload"))
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(rutafotosAlta & objFich.nombre)) Then
Response.write "Ya existe una foto con ese nombre. Renombrela para subirla al sevidor <br>"
subido = false
Else
fso.movefile Server.MapPath("/upload") & "\" & objFich.nombre,rutafotosAlta
subido = true
End If


set fso = nothing


'Y guardamos una copia, con nombre "subido.bin"

'objFich.GuardarComo("pa.bin", Server.MapPath("."))
if subido then
rsFotosFichero.open "fotos",conexion
rsFotosFichero.addnew
rsFotosFichero("id") =objUpload.Form("idvehiculo")
rsFotosFichero("nombre_foto") = objFich.nombre

rsFotosFichero.update
end if
set rsFotosFichero = nothing

set objFich = nothing


set objUpload = nothing
%>
<%if subido then%>
<strong>El fichero se ha grabado correctamente </strong></p>
<%else %>
<strong>El fichero NO se ha subido correctamente porque ya existe en el servidor </strong>
<%end if%>
<p class="normal"><strong>pulse <a href="javascript:cerrar();">aqui</a> para cerrar esta ventana</strong> </p>
</div>
<script language="JScript">

function cerrar()
{
window.opener.history.go(0)
self.opener.location.href = self.opener.location;
window.close();
}

</script>
</body>
</html>
__________________
"El Universo simpre quiere que ganemos"