Announcement Announcement Module
Collapse
No announcement yet.
File upload to AbstractCommandController - files not there Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • File upload to AbstractCommandController - files not there

    I have an AbstractCommandController and a command bean that binds 4 small files from a request successfully;

    however, a fifth file is too large for this tactic so I'm trying to access it using a CommonsMultipartResolver (and a MultipartHttpServletRequest derived from it).

    But the request is empty of any files! even though the other files were bound to the command object successfully! Does Spring strip these files from the request somewhere in the workflow? Any ideas?

    Code:
        protected ModelAndView handle(HttpServletRequest request,
                HttpServletResponse response,
                Object command,
                BindException errors)
                throws Exception {
            String                      fNm;
            Iterator                    iter;
            
            try {
                MultipartHttpServletRequest multipartRequest;
                multipartRequest = multipartResolver.resolveMultipart(request);
                iter = multipartRequest.getFileNames();
                while (iter.hasNext()) {
                    fNm = (String) iter.next();
                    System.out.println(" File = " + fNm);
                }
            } catch (MultipartException pE) {
                System.out.println("   " + pE);
            }
    The above code indicates an empty Request when ran (i.e. doesn't print anything to the console). :shock:
Working...
X