• ng file上传同域非同域


    跨域

    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));
    });
    }
    }

  • 相关阅读:
    VMware中Ubuntu 14.04出现Unknown Display问题解决
    VMWare桥接、NAT和only-host三种模式
    Tomcat目录下文件详解
    Java socket2
    Java socket1
    网络基础知识
    java awt 乱码问题
    窗口Dialog
    windowsEvents
    鼠标适配器Adapter
  • 原文地址:https://www.cnblogs.com/forhell/p/9088446.html
Copyright © 2020-2023  润新知