codeigniter angular ajax file upload返回文件的null值

时间:2017-06-02 22:14:37

标签: angularjs ajax codeigniter file uploading

使用angular codeigniter的Ajax文件上传器返回文件数据的空值

stmt
$http({
 method: 'POST',
 url: 'add',
 headers: {'Content-Type': false,'data-type': 'json'},


 data: $scope.setting
 }).success(function (data) {
 console.log(data);
 $scope.messageEdit = data;
 $scope.message="";
 });

1 个答案:

答案 0 :(得分:0)

我得到了答案

var myFormData = new FormData();
 var photo=document.getElementById('st_logo');
 var file=photo.files[0];
 console.log(file.name+"   "+file.size);

myFormData.append("currency", $scope.setting.st_currency);
    myFormData.append('bgcolor', $scope.setting.st_billingbgcolor);
    myFormData.append('textcolor', $scope.setting.st_billingtextcolor);
	myFormData.append('logo',file );