跨域
vm.uploadFiles = function (file, errFiles) {
if (file) {
file.upload = Upload.upload({
url: vm.uploadurl + "upadloadimgs?imgtype=upload",
data: {
files: file
}
});
abp.ui.setBusy();
file.upload.then(function (response) {
abp.ui.clearBusy();
if (response.status == "200") {
abp.notify.info("上传成功!");
vm.adimagefile = vm.uploadurl + response.data.Data.substring(1);
vm.adimage.adImageUrl = response.data.Data;
}
else {
abp.message.error(response.status + ': ' + response.data);
}
//alert("成功?");
}, function (response) {
abp.ui.clearBusy();
if (response.status > 0) {
abp.message.error(response.status + ': ' + response.data);
}
//$scope.errorMsg = response.status + ': ' +response.data;
}, function (evt) {
file.progress = Math.min(100, parseInt(100.0 *
evt.loaded / evt.total));
});
}
}
同域
vm.uploadFiles = function (file, errFiles, item) {
//alert(item);
if (file) {
file.upload = Upload.upload({
url: abp.appPath + "FileUpload/Upload?uptype=cmsimage",
data: {
files: file
}
});
abp.ui.setBusy();
file.upload.then(function (response) {
abp.ui.clearBusy();
if (response.status == "200") {
abp.notify.info("上传成功!");
item.adimagefile = abp.appPath + response.data[0].substring(1);
item.settingValue = response.data[0];
}
else {
abp.message.error(response.status + ': ' + response.data);
}
//alert("成功?");
}, function (response) {
abp.ui.clearBusy();
if (response.status > 0) {
abp.message.error(response.status + ': ' + response.data);
}
//$scope.errorMsg = response.status + ': ' +response.data;
}, function (evt) {
file.progress = Math.min(100, parseInt(100.0 *
evt.loaded / evt.total));
});
}
}