1

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?

1
  • are you only want to add file input field in form? Commented Apr 12, 2011 at 10:52

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

1 Comment

nope... it doesn't solve the problem. (the little script above.) no inut field is added.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.