zhangjason / gwtupload

Automatically exported from code.google.com/p/gwtupload
Other
0 stars 0 forks source link

Invalid file types still show up 'queued' #73

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Define a file extension filter
2. Try uploading a file with an invalid extension

What is the expected output? What do you see instead?
expected output - user sees warning popup and the file is not included anywhere
actual behavior - users sees warning and the file is listed as 'queued'

Also, user can attempt to add the same file again and it keeps on adding more 
rows of 'queued'.

What version of the product are you using? On what operating system?
0.6.2, on Windows

Please provide any additional information below.
Another nice thing to add would be if the warning message was customizable. We 
were previously using GXT FileUpload and had a custom message we displayed 
elsewhere on the screen.

Original issue reported on code.google.com by sandeep....@gmail.com on 22 Sep 2010 at 2:25

GoogleCodeExporter commented 8 years ago
There is a workaround for this. Use the following snippet to show the file 
listed as "error". This not exactly your expected behaviour but it comes close.

defaultUploader.addOnStatusChangedHandler(new 
IUploader.OnStatusChangedHandler() {
            private Set<IUploader> uploadersWithErrors = new HashSet<IUploader>();
            @Override
            public void onStatusChanged(IUploader uploader) {
                if (uploadersWithErrors.contains(uploader)) {
                    if (!Status.ERROR.equals(uploader.getStatus())) {
                        uploader.getStatusWidget().setStatus(Status.ERROR);
                    }
                }
                if (Status.ERROR.equals(uploader.getStatus())) {
                    uploadersWithErrors.add(uploader);
                }
            }
});

Original comment by Christop...@gmail.com on 15 Dec 2010 at 7:41

GoogleCodeExporter commented 8 years ago
Thanks for the response, Chris. I had almost forgotten about this 
ticket....that tells that things need to pick up pace on gwt-upload project!

Since we didn't have any case where we show a file with errors, we went with 
the following solution, however I can see where we might need to do a hybrid 
solution.

            OnStatusChangedHandler onStatusChangedHandler = new OnStatusChangedHandler() {

                @Override
                public void onStatusChanged( IUploader uploader ) {
                    Uploader u = (Uploader) uploader;
                    if ( uploader.getStatus() == Status.ERROR ) {
                        u.removeFromParent();
                    }
                 }
            };

Original comment by sandeep....@gmail.com on 18 Dec 2010 at 1:01

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r818.

Thank you for reporting.

Original comment by manuel.carrasco.m on 29 Dec 2010 at 10:30