In order to change the upload box selection type dynamically,
we need to add the upload element attribute "multiple", and if we want to make the single file selection we have to remove the attribute "multiple".
- <span>Sample File Selection</span><br/>
- <input type="file" name="One" id="SampleFileUpload"/><br/><br/><br/>
- <br/>
- <span>Multiple file selection</span><input type="checkbox" id="Mutiple"><br/>
- <button id="change" onclick="Change()" >Change Single/Multiple file select upload</button>
Script for changing dynamically:
- function Change()
- {
- if(document.getElementById("Mutiple").checked)
- document.getElementById("SampleFileUpload").setAttribute("multiple","sample");
- else
- document.getElementById("SampleFileUpload").removeAttribute("multiple");
-
- }