Propiedad Valor HTML DOM FileUpload
Definición y Uso
los rendimientos de los inmuebles de valor <input type "archivo" => ruta y el nombre de los elementos seleccionados.
En IE, Google Chrome, Opera, Firefox, propiedad del valor navegador Safari devuelve el nombre de archivo seleccionado camino falso.
Nota: Por razones de seguridad, esta propiedad es de sólo lectura.
gramática
fileuploadObject.value
Soporte para el navegador
Todos los principales navegadores soportan valor del atributo
Ejemplos
Ejemplos
Mostrar el nombre del archivo seleccionado:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
var x=document.getElementById("fname").value;
alert(x);
}
</script>
</head>
<body>
<form>
选择一个文件上传:
<input type="file" id="fname" size="50"/>
</form>
<button type="button" onclick="displayResult()">显示文件路径</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
var x=document.getElementById("fname").value;
alert(x);
}
</script>
</head>
<body>
<form>
选择一个文件上传:
<input type="file" id="fname" size="50"/>
</form>
<button type="button" onclick="displayResult()">显示文件路径</button>
</body>
</html>
Trate »
objetos FileUpload