softace/multiplefileupload

Not properly uploading the multiple files selected?

Opened this issue · 2 comments

Has this tool been thoroughly tested? I'm not sure it's implemented correctly. I don't know about non-HTML5 multi-file form based upload. But if we're talking HTML5 based multiple file uploader, you might need to add some additional code/logic on the client side to do the upload correctly.

Without even doing the upload, I notice possible issues:

Select your files but don't upload yet. Query via javascript for the value set when browsing for the multiple files. e.g. execute "document.getElementById('upload_files').value" w/o quotes in the javascript console of browser. I saw only 1 file out of n selected in Chrome and FF. Interestingly, in Chrome the UI showed "2 files" next to the file uploader button to show that 2 files were selected but querying the value only returns 1. I would have expected the console to spit out a javascript array (or object) for you to inspect. Similarly, if you perform the submit, it will just spit out the single file mentioned when you query the console.

The whole point about this project/tool is to demonstrate that multiple file upload has been possible all since HTML 4.01 (see http://en.wikipedia.org/wiki/File_select#Multiple_file_selection).

If you have expected a different behaviour from your javascript engine, then you should report that as an issue to the javascript engine project. If you have expected a different behaviour of your browser you should report that as an issue to the browser project. I don't think HTML4.01 defines anything about how javascript engines shall behave in this situation, but I do believe that HTML5 clarifies that, but I am not sure. Anyway that is an issue for the javascript engine, not this project.

Currently: Firefox, Chrome, and Opera correctly uploads multiple files when you select multiple files (typically by holding down the CTRL key while selecting). I don't expect IE to behave correctly. I can verify that the javascript engines in all three of these browsers does not behave as you expect, however that just emphasizes the need for this tool as a test platform for browsers and browser automation frameworks like selenium (http://code.google.com/p/selenium/issues/detail?id=2239).

If you experience that the browser does not upload more than one file, you have either only selected one file by a mistake) or you are using a non HTML4.01-compliant browser.

The reason you experience the described behaviour with javascript engines is
(quoting from http://code.google.com/p/selenium/issues/detail?id=2239#c19):
The problem is really that THERE IS NO VALUE for a single input element (of type=file and having attribute 'multiple') that is equivalent to selecting 2 files...

If you select 2 files in one input element. The closest equivalent DOM is actually two elements. That is if the source HTML is

<input type='file' name='files' multiple>

and you select two files, then the browser shall send (the CGI dictates that) what the following HTML (with two identical elements) would send

<input type='file' name='files' multiple>
<input type='file' name='files' multiple>