File Upload in GXT discriminates against certain file types
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()**) {
Fil开发者_如何学PythoneItemStream item = iter.next();
FileItem fileItem = fac.createItem(item.getFieldName(),
item.getContentType(), item.isFormField(),
item.getName());
try {
Streams.copy(item.openStream(), fileItem.getOutputStream(),
true);
...
This will not answer you question but I can find useful to tell about a good library for uploading files in GWT
GWTUpload is a library for uploading files to web servers, showing a progress bar with real information about the process (file size, bytes transferred, etc). It uses ajax requests to ask the web server for the upload progress. It has two components written in java, the server side with servlet and utility classes, and the client side that is compiled into javascript using gwt. here
精彩评论