wbstr / vaadin-multifileupload

12 stars 23 forks source link

Uploadwindow hangs #20

Closed kamuffe closed 8 years ago

kamuffe commented 10 years ago

Hi.

My Setup: vaadin 7.3.1 multifileupload 1.8 push disabled Valo Theme

I upload a file and the window appears on the screen. After round about 1% it hangs. I can close it or abort the upload. But the file is uploaded to the server. I tested with Chrome and FF 24.8.1

Regards, Christoph

ryildiz commented 9 years ago

Same issue exists for me with 1.9 version. A file of size 800MB is uploaded, upload window hangs around %1, however it accomplishes uploading, except we do not see status of upload on the screen due to freeze.

kamuffe commented 9 years ago

Issue still exists in 1.9 with vaadin 7.3.8.

Christoph

brintal commented 9 years ago

I can reproduce this issue with 1.9 and vaadin 7.4.5. It also happens with smaller files (<1MB)

juger89 commented 8 years ago

Could you provide a sample code where the problem can be reproduced? Still exists in 1.10?

kamuffe commented 8 years ago

Hi.

This Issue still exists with vaadin 7.6.3 and plugin 1.10. Further more it does not show up automatically and shows up and updates its contents only if I click somewhere else in the UI.

kamuffe commented 8 years ago

TestUI:

package sampleapp;

import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream;

import com.vaadin.server.VaadinRequest; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; import com.wcs.wcslib.vaadin.widget.multifileupload.ui.MultiFileUpload; import com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadFinishedHandler; import com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadStateWindow;

public class UploadTestUI extends UI {

private VerticalLayout mainLayout;

@Override
protected void init(VaadinRequest request)
{
    mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    setContent(mainLayout);

    UploadStateWindow win = new UploadStateWindow();
    win.setOverallProgressVisible(true);
    win.setCancelButtonCaption("Abbrechen");

    MultiFileUpload upload = new MultiFileUpload(new MyUploadFinishedHandler(), win);
    upload.addStyleName("uploadstyle");
    upload.setPanelCaption("aktueller upload ...");
    upload.getSmartUpload().setUploadButtonCaptions("Datei hochladen", "Dateien hochladen");

    mainLayout.addComponent(upload);

}
/**
 * Handler for uploading files
 */
private class MyUploadFinishedHandler implements UploadFinishedHandler
{

    @Override
    public void handleFile(InputStream stream, String fileName, String mimeType, long arg3)
    {
        /*
         * get users content dir
         */
        File contentDir = new File("C:/test");
        /*
         * try to copy uploaded files to users content dir...
         */
        try
        {
            /*
             * get current size in bytes
             */
            long currentSize = org.apache.commons.io.FileUtils.sizeOfDirectory(contentDir);

            /*
             * check if user content + incoming stream exceeds 100MB
             */
            if(currentSize + stream.available() > 104857600)
            {
                return;
            }

            /*
             * upload file and refresh file table
             */
            org.apache.commons.io.FileUtils.copyInputStreamToFile(stream, new File(contentDir, fileName));

        }
        catch (FileNotFoundException ex)
        {
        }
        catch (IOException e)
        {
        }
    }

};

}

kamuffe commented 8 years ago

There are also these errors in console log: Feb 22, 2016 4:01:49 PM com.vaadin.server.ConnectorResourceHandler error WARNUNG: Ignoring connector request for no-existent connector 18 in root 0 Feb 22, 2016 4:01:50 PM com.vaadin.server.ConnectorResourceHandler error WARNUNG: Ignoring connector request for no-existent connector 21 in root 0

developerin commented 8 years ago

Have the same errors on upload after call of handle Files.

juger89 commented 8 years ago

In case of push disabled and poll interval >> 1000, you should set poll interval in UploadStartedHandler to 1000 to refresh the window correctly and set back to the original value in UploadFinishedHandler.

oikonomopo commented 5 years ago

UploadStartedHandler

Can you give a more specific example?