小编ats*_*ann的帖子

设置 Content-Type: 在 angular js post 请求中

<input type="file" ng-model="articleimg" placeholder="upload related img">    

$http.post($scope.base_url+'create.php', 
            {params {view:'view',articleimg:$scope.articleimg}})
            .then(function(response){
                    console.log(response);
    });
Run Code Online (Sandbox Code Playgroud)

我想知道如何以及在何处指定此 angularjs 发布请求中的内容类型:multipart/form-data?

请协助。默认似乎是“application/json, text/plain”,它不适用于图像/文件上传。

if(isset($_FILES['articleimg'])===true ){
  echo "sucessfull";
}else echo "unsuccessfull";
Run Code Online (Sandbox Code Playgroud)

上面的代码总是回显不成功。

javascript post content-type http angularjs

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

angularjs ×1

content-type ×1

http ×1

javascript ×1

post ×1