commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mfncoo...@gmail.com>
Subject Re: [FileUpload] Empty FileItem list
Date Fri, 23 Sep 2005 16:19:12 GMT
On 9/23/05, Lutz Horn <sttmjoc0@fastmail.fm> wrote:
>
> Hi,
>
> I've got a problem using FileUpload 1.0 with Spring 1.2.1 inside Tomcat
> 5.0.28. I use to following form to upload a file to a web application
> (client is Firefox 1.5b1).
>
> <form action="upload.htm" method="post"
> enctype="multipart/form-data">
> <input type="file" name="file"/>
> <input type="hidden" name="id" value="<c:out value="${object.id<http://object.id>
> }"/>"/>
> <input type="submit"/>
> </form>
>
> Inside the web application the following Spring controller handles the
> request.
>
> public class UploadController extends AbstractController {
>
> protected ModelAndView handleRequestInternal(HttpServletRequest req,
> HttpServletResponse res) throws Exception {
>
> boolean isMultipart = FileUpload.isMultipartContent(request)
> DiskFileUpload upload = new DiskFileUpload();
>
> List items = upload.parseRequest(req);
> Integer filecount new Integer(items.size());
> }
> }
>
> Request type and encoding are correct, isMultipart is true. But the List
> returned by DiskFileUpload.parseRequest(req) is empty.
>
> Any ideas where to look?


I'm not familiar with Spring MVC, which is what I assume you are using.
However, the most likely cause of the problem you are seeing is that Spring
has already parsed the upload request for you, and so the input stream has
been consumed and is no longer available for (re)parsing by Commons
FileUpload.

--
Martin Cooper


Regards
> Lutz
> --
> email service provided by
> http://www.fastmail.fm/mail/?STKI=600622
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message