You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Chris Norris <th...@gmail.com> on 2008/05/14 22:34:10 UTC
[fileupload] getting the simplest case to work
Hi, I'm having trouble getting started with the FileUpload project. I
have a service (hooked up via CXF) that does the following for a post
request:
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(isMultipart)
{
ServletFileUpload upload = new ServletFileUpload();
FileItemIterator iterator = upload.getItemIterator(request);
System.out.println(iterator.hasNext());
}
The request is multipart, but the item iterator is always empty. I've
tried submitting the request in three different ways: first from an
Adobe Lightroom plugin (which is what I'm working on), then from a mac
command-line curl call, then from a simple form, which I can reproduce
here:
<html>
<head><title>testing</testing></head>
<form
action="http://cjn-pc.widen.com:8080/services/backdrop/backdropservice/upload/"
method="POST"
enctype="multipart/form-data">
<input type="file"/>
<input type="submit" value="test"/>
</form>
</html>
The item iterator always has zero items in it. I've also tried
executing this "simplest case" code:
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List /* FileItem */ items = upload.parseRequest(request);
The items list is always empty. I feel like I'm missing something
obvious here. Anyone have any ideas?
Thanks,
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [fileupload] getting the simplest case to work
Posted by Chris Norris <th...@gmail.com>.
Ah... if a file input doesn't have a name, things break. Good to know.
On Wed, May 14, 2008 at 3:34 PM, Chris Norris
<th...@gmail.com> wrote:
> Hi, I'm having trouble getting started with the FileUpload project. I
> have a service (hooked up via CXF) that does the following for a post
> request:
>
> boolean isMultipart = ServletFileUpload.isMultipartContent(request);
> if(isMultipart)
> {
> ServletFileUpload upload = new ServletFileUpload();
> FileItemIterator iterator = upload.getItemIterator(request);
> System.out.println(iterator.hasNext());
> }
>
> The request is multipart, but the item iterator is always empty. I've
> tried submitting the request in three different ways: first from an
> Adobe Lightroom plugin (which is what I'm working on), then from a mac
> command-line curl call, then from a simple form, which I can reproduce
> here:
>
> <html>
> <head><title>testing</testing></head>
> <form
> action="http://cjn-pc.widen.com:8080/services/backdrop/backdropservice/upload/"
> method="POST"
> enctype="multipart/form-data">
> <input type="file"/>
> <input type="submit" value="test"/>
> </form>
> </html>
>
> The item iterator always has zero items in it. I've also tried
> executing this "simplest case" code:
> FileItemFactory factory = new DiskFileItemFactory();
> ServletFileUpload upload = new ServletFileUpload(factory);
> List /* FileItem */ items = upload.parseRequest(request);
>
> The items list is always empty. I feel like I'm missing something
> obvious here. Anyone have any ideas?
>
> Thanks,
> Chris
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org