Search code examples
angularjsspring-mvcwebspheremultipartmultifile-uploader

Hidden iFrame for MultiPartFileUpload issue in FireFox Browser


My framework is Spring-MVC with AngularJS. For File Upload i am using Multipart File Upload. I created a hidden iFrame to submit file to backend. The code looks like this.

 function fnUploadFile(formData){
        var iframe = $('<iframe name="postiframe" id="postiframe" style="display: none"></iframe>');
        $("body").append(iframe);
        var form = $('#uploadform');
        form.attr("action", CONTEXT_PATH+"admin/uploadPDF");
        form.attr("method", "post");
        form.attr("encoding", "multipart/form-data");
        form.attr("enctype", "multipart/form-data");
        form.attr("target", "postiframe");
        form.attr("uploadfile", $('#uploadfile').val());
        var input =  $('<input type="hidden" name="filename"/>').val(formData);
        input.appendTo(form);
        form.submit();
    }

After that I save the file in server location.I am having problem while uploading file from FireFox browser. Its opening a new pop-up right after we click upload button.

This the popup am getting.

Can someone help resolving this issue?


Solution

  • Found the solution for it by myself. Just added text/plain as header in HttpServletResponse. It resolves my problem.