wenhongquan / ocupload

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

Values specified after params: get duplicated #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a ocupload object using params:
2. upload a file, then upload another
3. the POST data contains multiple entries of the params: values

What is the expected output? What do you see instead?
The values specified after params: should be added to the form just once.
Instead the values get duplicated into the form with each upload.

What version of the product are you using? On what operating system?
v1.1.2

Please provide any additional information below.
I resolved it with the following code (at line 215). I remove the hidden
input fields before adding them :

/** add additional paramters before sending */
$.each(options.params, function(key, value) {
    $('#ocu' + key).remove();
    form.append($(
        '<input ' +
            'id="ocu' + key + '" ' +
            'type="hidden" ' +
            'name="' + key + '" ' +
            'value="' + value + '" ' +
        '/>'
    ));
});

(I don't know how to select elements by 'name' so I introduced an extra
'id' field, don't know if this is really neccesary).

Original issue reported on code.google.com by joepgroo...@gmail.com on 15 Jan 2009 at 4:18