title: How to upload an image and save it in database?
body: <p>I have to create a form using JavaScript and an user will upload a JPG file and submit along with other info such as name, email, etc. When the user clicks submit all the information from the form will be loaded to a value object. For the image file I've set it to be <code>byte[]</code>.</p>
  
  <p>So assuming:</p>
  
  <pre><code>public String name;
  public String email;
  public byte[] logo;
  </code></pre>
  
  <p>I've set up a servlet as well to handle the submission but I'm not sure how to get started. How does the upload work? When user submits, how do I get the information for the image? Here's a screenshot: <a href="http://imageshack.us/f/32/77675354.png/" rel="noreferrer">http://imageshack.us/f/32/77675354.png/</a> I need to convert that image and save it to a <code>byte[]</code> then convert to blob so I can insert it to a table.</p>