Using <img for the browse button of a <input type=file

Hello,

I red the input type file problems with default value .... and understand why there's security problem which avoid this functionality.

But, I don't understand why this does not work.
I just would use the style="display:none" of the input and a image to display the button. When I click on the picture, I launch input 
file.click() . So the popup for  choosing the file to upload appear, the user choose the file... 
But when I submit the form, I have an js error.
There's no security problem here since the user choose the file. So i don't understand why I have this error.
That 's the difference between :
  - First, the user clicks on the browse button 
  - Second, the click is fired with js ?


<form name="formPrincipal" method="post" action="resultat.php" enctype='multipart/form-data'>
 Fichier 1<input type="file" name="PHOTO1" style="display:none;">
	<input type="text" name="file">
	<img align=middle name="Parcourir" src="../images/parcourir.gif"  border="0" 
onClick="document.formPrincipal.PHOTO1.click(); document.formPrincipal.file.value=document.formPrincipal.PHOTO1.value;">
	<input type='button' value='Submit2' onclick='document.formPrincipal.submit();'>
</form>
 		


------------------------------------------

Faites un voeu et puis Voila ! www.voila.fr 

Received on Monday, 17 March 2003 12:19:41 UTC