Foros del Web » Programando para Internet » Javascript »

Ayuda con esta FAQ. no me funciona.

Estas en el tema de Ayuda con esta FAQ. no me funciona. en el foro de Javascript en Foros del Web. Hola que tal. Probé el código de esta FAQ: http://www.forosdelweb.com/out.php?h...8%23post426198 Y no funciona, me da error de cadena no terminada o algo asi, en la ...
  #1 (permalink)  
Antiguo 25/02/2004, 08:45
 
Fecha de Ingreso: noviembre-2003
Mensajes: 89
Antigüedad: 20 años, 6 meses
Puntos: 0
Ayuda con esta FAQ. no me funciona.

Hola que tal.
Probé el código de esta FAQ: http://www.forosdelweb.com/out.php?h...8%23post426198
Y no funciona, me da error de cadena no terminada o algo asi, en la linea:
Código PHP:
while (file.indexOf("\") != -1) file = file.slice(file.indexOf("") + 1); 
Utilizo IE 5.5 y 6.
Tal vez alguien me pueda dar una mano.
Gracias por la ayuda. Hasta Pronto.
  #2 (permalink)  
Antiguo 25/02/2004, 11:24
Avatar de JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 2 meses
Puntos: 772
Hola, heyman.

Prueba a poner:

while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("") + 1);

Saludos,

Última edición por JavierB; 25/02/2004 a las 11:25
  #3 (permalink)  
Antiguo 26/02/2004, 15:50
 
Fecha de Ingreso: noviembre-2003
Mensajes: 89
Antigüedad: 20 años, 6 meses
Puntos: 0
Gracias JavierB por la ayuda.

Ya no aparece error en la pagina, pero el script NO hace lo que tiene que hacer,
En el input he probado quitarle el [I] sale la advertencia pero al
darle otro submit manda el arhivo invalido, y al elegir un archivo valido igual sale la ventana de advertencia.
Aqui dejo el código por si alguien quiere darme una mano.
Código PHP:
<html>
<
head>
<
title>Subir Imágenes</title>
<
script language="javascript">
function 
LimitAttach(tField,iType) {
file=tField.value;
if (
iType==1) {
extArray = new Array(".gif",".jpg",".png");
}
if (
iType==2) {
extArray = new Array(".swf");
}
if (
iType==3) {
extArray = new Array(".exe",".sit",".zip",".tar",".swf",".mov",".hqx",".ra",".wmf",".mp3",".qt",".med",".et");
}
if (
iType==4) {
extArray = new Array(".mov",".ra",".wmf",".mp3",".qt",".med",".et",".wav");
}
if (
iType==5) {
extArray = new Array(".html",".htm",".shtml");
}
if (
iType==6) {
extArray = new Array(".doc",".xls",".ppt");
}
allowSubmit false;
if (!
file) return;
while (
file.indexOf("\\\") != -1) file = file.slice(file.indexOf("") + 1);
ext = file.slice(file.indexOf("
.")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray == ext) {
allowSubmit = true;
break;
}
}
if (allowSubmit) {
} else {
tField.value="";
alert("
Usted sólo puede subir archivos con extensiones " + (extArray.join(" ")) + " Por favor seleccione un nuevo archivo");
}
}
</script>
</head>
<body>
<form enctype="
multipart/form-data" action="guardar.php" method="POST">
<input type="
hidden" name="MAX_FILE_SIZE" value="30000">
TITULO: <input type="
text" name="nov_titulo">

SUBIR ESTA IMAGEN: <input name="
userfile" type="file" [I]onBlur='LimitAttach(this,1);'>
<input type="
submit" value="Send File">
</form>
</body>
</html> 
Espero que me puedan ayudar. Hasta Pronto.
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 21:56.