Javascript DOM HTML Input FileUpload multiple Property set

Introduction

Allow the user to select multiple files:

document.getElementById("myEmail").multiple = true;

Click button to allow multiple files for the file upload button.

View in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  Select files: <input type="file" id="myFile" name="files">
  <input type="submit">
</form>// ww w. j  a  v a2  s .c o m
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("myFile").multiple = true;
  document.getElementById("demo").innerHTML = "The file upload button now accept multiple values.";
}
</script>

</body>
</html>



PreviousNext

Related