First of all here is my code:
<form id="registration_form" action="AddProductServlet" method="post">
<div>
<label>
<input placeholder="Product ID" name="pid" type="text">
</label>
</div>
<div>
<label>
<input placeholder="Product Name" name="pname" type="text">
</label>
</div>
<div>
<h3> Choose Image to Upload </h3>
<form action="upload" method="post" enctype="multipart/form-data">
<input type="file" name="file" />
<input type="submit" value="Add Product" />
</form>
</div>
</form>
As I have done here, having a form tag within a form tag is invalid.
Also since it is not possible to invoke the two different actions within the same form tag.
So is there any way I can both upload the image to my local drive and also get the product details and the image name to be stored in the database for later retrieval?