1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| <!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>file</title>
<style>
input { width:800px; }
</style>
</head>
<body>
<form id="formFile" action="monAction" enctype="multipart/form-data" method="POST">
<input id='file1' type='file' name='file1' />
</form>
<button id="addCover">Ajouter le cover</button>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(function(){
var result = "";
$( "#file1" ).on( "change", function(){
if ( result.length > 0 ){
result += " , " + $( this ).val();
} else {
result = $( this ).val();
}
console.log( result );
});
$( "#addCover" ).on( "click", function(){
$( "#file1" ).click();
});
});
</script>
</body>
</html> |
Partager