<html>
<head>
<title>show a open old file dialog to select files in JavaScript</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body style="background:lightgray">
<p>Click the button to test:</p>
<input type="file" id="fileUpload" multiple>
</br>
<textarea id="edit" style="height:200px;width:240px">
this is a test
</textarea>
<script>
$('input[type=file]').change(function () {
var text="";
for(var i=0;i<this.files.length;i++){
text+=this.files[i].name+"\n";
}
$('#edit').val(text)
})
</script>
</body>
</html>
Comments
Post a Comment