Send FormData with other field in AngularJS

前端 未结 5 1077
天涯浪人
天涯浪人 2020-11-28 09:46

I have a form with two input text and one upload. I have to send it to the server but I have some problem concatenating the file with the text. The

5条回答
  •  粉色の甜心
    2020-11-28 10:35

    You're sending JSON-formatted data to a server which isn't expecting that format. You already provided the format that the server needs, so you'll need to format it yourself which is pretty simple.

    var data = '"title='+title+'" "text='+text+'" "file='+file+'"';
    $http.post(uploadUrl, data)
    

提交回复
热议问题