Foros del Web » Creando para Internet » HTML »

Nombre del fichero de un input type file

Estas en el tema de Nombre del fichero de un input type file en el foro de HTML en Foros del Web. Como puedo obtener el nombre del fichero seleccionado en un input type "file", sin la ruta, solo el archivo seleccionado, ya que si utilizo la ...
  #1 (permalink)  
Antiguo 02/05/2002, 09:52
 
Fecha de Ingreso: marzo-2002
Mensajes: 132
Antigüedad: 22 años, 1 mes
Puntos: 0
Nombre del fichero de un input type file

Como puedo obtener el nombre del fichero seleccionado en un input type "file", sin la ruta, solo el archivo seleccionado, ya que si utilizo la propiedad value del file me entrega la ruta completa.
  #2 (permalink)  
Antiguo 09/05/2002, 08:16
bet
 
Fecha de Ingreso: febrero-2001
Mensajes: 292
Antigüedad: 23 años, 2 meses
Puntos: 0
Re: Nombre del fichero de un input type file

Esto te puede servir?

Código:
<html>
<head>
<title> Mostrar Archivo </title>
<script language="JavaScript">
<!--
function checkForm(){
	if (document.forms[0].arch.value == ""){
		alert("Seleccione un archivo");
		return false;
	}

	bet1=document.forms[0].arch.value.lastIndexOf('\\')+1;
	bet2=document.forms[0].arch.value.indexOf('html') + 4;
	pagi=document.forms[0].arch.value.substring(bet1,bet2);
}
//-->
</script>
</head>

<body>

<form method=post action="">
	<input type="file" name="arch"> <br><br>
	<input type="button" value="Ver Archivo" onClick="checkForm();">
</form>

</body>
</html>
<hr noshade size=1><img src="http://www.gograph.com/Images-8712/ClipArt/cat03.gif" height="50" border=0 align="absmiddle"> <font size="2" face="verdana" color="#000000">bet[/CODE]
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 12:03.