I have multiple file upload boxes in a single HTML form and in each file box there is an associated upload button and a div container. Clicking the upload button should upload the respective file via AJAX (jQuery). I revered various questions and blogs where there is always a one file upload with one submit button. But my question here is how to upload the selected file on a click event on a button without submitting the entire form. Is that possible?
I put a mock HTML code and the corresponding jsfiddle also
<form id='parent-form' action='complete.php'>
<div>
<input type='file' name='img1'/>
<input type='button' value='upload' name='btnimg1' />
</div>
<div>
<input type='file' name='img2'/>
<input type='button' value='upload' name='btnimg2' />
</div>
<div>
<input type='file' name='img3'/>
<input type='button' value='upload' name='btnimg3' />
</div>
<br/>
<input type='submit' value='Complete' />
</form>