cambiar el valor de un input file
Quiero cambiar el valor de in input tipo file desde una funcion javaScript. Cualquier input lo acepta sin problemas ... no entiendo pq el input file no me deja ...
Para muestra este codigo:
Probarlo vereis que cuando elegeis un fichero, posteriormente deberia poner el valor "naranjas". Tal y como si hace el input normal.
<code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function cambia(objeto){
objeto.value="naranjas";
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<p>
<input name="paMuestraUnBoton" type="file" accept="image/gif, image/jpeg, application/x-shockwave-flash" onChange="cambia(this)" />
</p>
<p>
<input type="text" name="yosi" onChange="cambia(this)">
</p>
</form>
<p>&nbsp;</p></body>
</html></code>
II GemInIs II
uhhm :?
dagi3d
supongo que seran restricciones de seguridad
si se pudiese modificar el valor de un input file via javascript cualquier pagina te podria coger el fichero que quisiera y enviarla sin que pudieses hacer nada (te lo ponen en un iframe y es que ni te enteras)