views:

288

answers:

0

We are using GXT (EXT + GWT) and Apache commons file upload servlet utility. We have file uploads working but certain types are not uploaded, e.g., text files. Even if the text files have their extension changed they are still not uploaded.

In the FileUploadBase.parseRequest method this is the code that seems to be found to skip the input stream from being copied to the file system. I tried to bold the iter.hasNext() code that skips the stream.copy line of code when I break point the upload for a text file.

Any advice would be appreciated!

Thanks in advance.

    public List /* FileItem */ parseRequest(RequestContext ctx)
        throws FileUploadException {
    try {
        FileItemIterator **iter = getItemIterator(ctx)**;
        List items = new ArrayList();
        FileItemFactory fac = getFileItemFactory();
        if (fac == null) {
            throw new NullPointerException(
                "No FileItemFactory has been set.");
        }
        while (**iter.hasNext()**) {
            FileItemStream item = iter.next();
            FileItem fileItem = fac.createItem(item.getFieldName(),
                    item.getContentType(), item.isFormField(),
                    item.getName());
            try {
                Streams.copy(item.openStream(), fileItem.getOutputStream(),
                        true);
...