I have a form in which I am uploading pictures. I don't know how many pictures I may upload at a specific time. Are there any jQuery/AJAX solutions for dynamically adding a file upload field in a form?
            Asked
            
        
        
            Active
            
        
            Viewed 1.4k times
        
    1 Answers
2
            simple code for adding a file field in form using jQuery
<form id="myForm" action="your-action">
    <input type="file" name="files[]" />
    <a href="#" onclick="addMoreFiles()">Add More</a>
</form>
<script>
       function addMoreFiles(){
           $("#myForm").append('<input type="file" name="files[]" />')
       }
 </script>
 
    
    
        Naren Sisodiya
        
- 7,158
- 2
- 24
- 35
- 
                    nope... it doesn't solve the problem. (the little script above.) no inut field is added. – dana Apr 13 '11 at 09:59
 
    