Multer: [Error: Multipart: Boundary not found]

Created on 26 Jul 2016  路  2Comments  路  Source: expressjs/multer

I wanna post the file with AJAX.

My JQuery code is:

 $.ajax({
                    type: 'POST',
                    url: '/uploadPhoto',
                    data: $('#fileUp').attr('files'),
                    cache: false,
                    //contentType: 'multipart/form-data',  //removed
                    processData: false,
                   dataType: "text",
                    success: function(data){
                        alert(data);
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        console.log(XMLHttpRequest.status);
                        console.log(XMLHttpRequest.readyState);
                        console.log(textStatus);
                    }
                });

When I was post like this, the Nodejs's console show"[Error: Multipart: Boundary not found]".

What's the problem? How can I fix it? Anybody help~~~

Most helpful comment

See this StackOverflow post on how to make multipart uploads with jQuery.

All 2 comments

See this StackOverflow post on how to make multipart uploads with jQuery.

        var img=document.getElementById("input-img");
        var video=document.getElementById("input-video-id-fv41");

           var formdata = new FormData();
           formdata.append('img',img.files[0]);
           formdata.append('video',video.files[0]);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChristianRich picture ChristianRich  路  4Comments

trexanhvn picture trexanhvn  路  3Comments

thammarith picture thammarith  路  3Comments

kiwenlau picture kiwenlau  路  4Comments

sant123 picture sant123  路  4Comments