Prévisualisation d'image à uploader
Bonjour,
Je cherche comment afficher une prévisualisation d'un fichier image à
uploader, avant son envoi sur le serveur.
Le code suivant ne fonctionne pas :
-------------------------------------------------------
<html>
<head>
<title>Test copie upload image</title>
<script type="text/javascript">
function change_photo1() {
var uploadSrc = encodeURI( document.form1.selectimage1.value );
if( uploadSrc != "" ) {
var copie = document.getElementById( "photo1" );
copie.src = "file:///" + uploadSrc;
}
}
</script>
</head>
<body>
<img id="photo1" src="defaut.jpg">
<form name="form1" enctype="multipart/form-data" method="post">
<input type="file" name="selectimage1" onchange="change_photo1();">
</form>
</body>
</html>
---------------------------------------------------------
Avez-vous une idée ?
Merci, Pascal
|