wbstr / vaadin-multifileupload

12 stars 23 forks source link

Browser repaint triggers the file upload again and upload #5

Closed AnandVemula closed 11 years ago

AnandVemula commented 11 years ago

Hi,

I've used the component and found an issue. When I used it, everything works fine. However, after the upload is finished, if I revisit the browser again (after changing windows), the last uploaded list of files is repeatedly streamed again and again until a new one. I tried all the possible ways and it doesn't stop programatically.

Any advice / Idea to resolve the issue(s)..?

Thanks & Regards Anand

juger89 commented 11 years ago

I could not reproduce your problem. Could you give me some additional information about -which version of MultiFileUpload you are using; -which browser and which browser version you are using? Could you provide me a sample code and/or a running a test application?

AnandVemula commented 11 years ago

Hi, thanks for the response. I’ll update the same tomorrow with all necessary details….

Thanks & Regards Vemula, Anand Sr. Technical Architect Applied Discovery/Aeries Technology | Laxmi cyber center, 8-2-682, Road No.12, Banjara Hills, Hyderabad, India – 500034 | Work: +91-40-67294636 | Mobile: +91-8008920404 | http://www.applieddiscovery.com

From: Gergely Juhász [mailto:notifications@github.com] Sent: 16 September 2013 16:15 To: wbstr/vaadin-multifileupload Cc: Vemula, Ananda Rao (INDIA) Subject: Re: [vaadin-multifileupload] Browser repaint triggers the file upload again and upload (#5)

I could not reproduce your problem. Could you give me some additional information about -which version of MultiFileUpload you are using; -which browser and which browser version you are using? Could you provide me a sample code and/or a running a test application?

— Reply to this email directly or view it on GitHubhttps://github.com/wbstr/vaadin-multifileupload/issues/5#issuecomment-24501736.

YoungFa commented 11 years ago

Hi, I got the same issue and I think I found the source to the problem. I'm using MultiFileUpload 1.4. The problem occurs everytime the fileselection input field <input type="file" class="gwt-FileUpload" multiple="multiple" name="###_file" accept=""> is focusd. The field is hidden by via css so it may not be that obvious at first.

I've checked the VMultiUpload code and found this in myFileUpload:

        @Override
        public void onBrowserEvent(Event event) {
            super.onBrowserEvent(event);
            if (event.getTypeInt() == Event.ONCHANGE && hasFiles()) {
                submit();
            }
        }

So the selected files get uploaded everytime that field is focused. This is especially troublesome if you put the upload between form elements where users usally tab from field to field.

juger89 commented 11 years ago

Are you sure that the problem still exists in version 1.4? Did you recompile your widgetset? Because until 1.4, this condition (event.getTypeInt() == Event.ONCHANGE) was missing in the code above and yes, after the field get focused, the selected files were uploaded again or duplicated in the queue. I could easily reproduce this with the tab key as you said. But with this fix, the field only get submitted on the ONCHANGE event, not the ONFOCUS.

YoungFa commented 11 years ago

You're right. I forgot to recompile the widgetset.

juger89 commented 11 years ago

OK, I think this problem is solved.

AnandVemula commented 11 years ago

Hi, thanks for the feedback & update. Here is my update after few trials with 1.5-SNAPSHOT...

Sorry to say, this problem still exists. Earlier, I had worked with 1.4 SHAPSHOT. In that version, the check was NOT there in the code ... if (event.getTypeInt() == Event.ONCHANGE && hasFiles()) ... ...

I took the latest a short while ago, recompiled the widgetset & tried it in my application. The problem still exists. I uploaded 5 files and navigated to other browser windows and re-entered the page several times. I see the 5 files being re-streamed as many times I visited the page.

More-over, when I click the upload button once again, I see those files getting streamed again even while I browse the files in the file chooser. Once the new files are uploaded, the older ones stop getting uploaded. But this time, it re-tries the newer ones i.e. always the last selected file set is being re-streamed.

I know, the problem but having limited knowledge on browser's UI & events...

Thanks & Regards Anand

AnandVemula commented 11 years ago

Extremely sorry, it was my mistaken reference to the old version. After corrected, re-compiled version, it works fine. No issues found. Sorry for mistaken posting..