0

How can I upload multi file and send checkbox using java servlet?

What method is best way to use?

Post?

What about enctype in html form?

What will be the code in java servlet ?

<form method="post" action="" enctype="multipart/form-data"> 
<input type="checkbox"  name="notifi-user-via-email" id="notifi-user-via-email" value="notifi-user-via-email">
<input type="file" name="fileUpload" id="files" size="50" multiple/>
<input type="submit" value="Upload" />
</form>

Thank you for your explain!

1 Answers1

0

enctype should be set to "multipart/form-data" as you have done. POST or GET doesn't matter. You should have a @Multipart annotation in your Servlet where you receive the HTTP Request. Refer this: JavaEE Tutorial

brijs
  • 525
  • 6
  • 18