Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicat #152

Open
ofly opened this issue Nov 29, 2018 · 1 comment
Open

duplicat #152

ofly opened this issue Nov 29, 2018 · 1 comment

Comments

@ofly
Copy link

ofly commented Nov 29, 2018

when upload multi-files in form-request, like:

<input name="file" type="file" id="uploadFiles" multiple="multiple" />

then, in /org/kohsuke/stapler/RequestImpl.java#parseMultipartFormData() method, multi files will have the some feildname, and last pared file will cover the prior parsed file:

private void parseMultipartFormData() throws ServletException {
    if(parsedFormData!=null)    return;
    // use map to store fileItem, and use feildname as key.
    parsedFormData = new HashMap<String,FileItem>();
    parsedFormDataFormFields = new HashMap<String, String>();
    ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
    try {
        for( FileItem fi : (List<FileItem>)upload.parseRequest(this) ) {
            parsedFormData.put(fi.getFieldName(),fi);
            if (fi.isFormField()) {
                parsedFormDataFormFields.put(fi.getFieldName(),fi.getString());
            }
        }
    } catch (FileUploadException e) {
        throw new ServletException(e);
    }
}

I am not sure where should I fix this problem, front-end or back-end? Anyone have some suggests?

@ofly
Copy link
Author

ofly commented Nov 29, 2018

Besides, this problem occurs in jenkins, when try to modify it's FileParameter plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant