I'm attempting to upload files with apache common-fileupload and spring, and my form consists of fields also. however when i'm attempting to submit always getting null pointer exception

now using Multipartstream to get solution on a single.

@RequestMapping(value="/uploadfile.do", method = RequestMethod.POST)
public ModelAndView uploadFile(@ModelAttribute("frm") ReceiptForm form, BindingResult result, HttpServletRequest request){

    System.out.println("---"+form.getProductName());
    System.out.println("---"+form.getRfile());

    ModelAndView mav = new ModelAndView("receipt/upload");
    mav.addObject("command", form);
    return mav;

}

The next example shows ways to use the CommonsMultipartResolver:

<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="100000"/>

With the addition of this for your spring config your remotes should pickup file uploads

or try google