0
如果文件扩展盘区的大小如何实现,我想从服务器发回数据到我的控制器是我的代码。将角度js返回给控制器的值
myApp.service('fileUpload', ['$http', function ($http) {
this.uploadFileToUrl = function (fileData, uploadUrl) {
if (fileData.size > 50000000) {
var fd = new FormData();
fd.append('file', fileData);
$http.post(uploadUrl, fd, {
transformRequest: angular.identity,
headers: { 'Content-Type': undefined }
})
.success(function() {
})
.error(function() {
});
}
else {
return "Image size is more than 5MB";
}
}
}]);
使用'回调“,因为它是异步操作... – Rayon
你能写出解决方案吗? –