title: How to consume image upload data as byte[] using Spring MVC 3
body: <p>I need write the image data in a particular directory on the server side but I am getting a null for the raw byte[] image upload data that I am trying to send from an html form and jquery ajaxuploader plugin from <a href="http://valums.com/ajax-upload/" rel="nofollow noreferrer">here</a>.</p>
  <p>Following is the snippet from the controller I am using to handle raw bytes of image being uploaded:</p>
  <pre><code>@RequestMapping(value = &quot;uploadImage&quot;, method = RequestMethod.POST)
  public void uploadImage(byte[] uploadData, Writer writer, HttpServletRequest request) throws IOException, JSONException {
      //uploadData is turning out to be null
      //..
  }
  
  @InitBinder
  protected void initBinder(ServletRequestDataBinder binder) {
      binder.registerCustomEditor(byte[].class,
              new ByteArrayMultipartFileEditor());
  }
  </code></pre>
  <p>I have got the following configured in the spring configuration file for handling uploads:</p>
  <pre><code>&lt;bean id=&quot;multipartResolver&quot; class=&quot;org.springframework.web.multipart.commons.CommonsMultipartResolver&quot;&gt;
  &lt;/bean&gt;
  </code></pre>
  <p>I am using Spring MVC 3. Could someone guide me on how to send raw bytes of upload data?</p>
  <p>Thanks.</p>