上传文件JS

 上传文件

//上传文件
$scope.filePath;
$scope.selFile = function (address, name) {

    filePath = "";
    var fileList = [];
    if (model.tid != "0") {
        for (var i = 0; i < address.length; i++) {
            if (address[i].length > 0) {
                fileList.push({ "FilePath": address[i], "FileName": name[i] });
            }
        }
    }

    $scope.uploadPicList({ list: fileList, allowNum: 100 }, function (selectedItem) {
        for (var i = 0; i < selectedItem.length; i++) {
            /*
            在上传附件拿到上传的附件结果列表后,
            遍历列表,
            检查allFileNameList中是否存在当前项,
            如果存在,不进行push操作,
            反之,将当前项铺设到allFileNameList中
            避免文件重复添加
            */
            var flag = 0;
            for (var j = 0; j < $scope.allFileNameList.length; j++) {
                if (selectedItem[i].FileName == $scope.allFileNameList[j]) {
                    flag = 1;
                    break;
                }
            }
            if (flag == 0) {
                $scope.allFileNameList.push(selectedItem[i].FileName);
                $scope.allAddressList.push(selectedItem[i].FilePath);
            }
        }
    });
};

文件上传取消

//文件上传取消
$scope.remove = function (removeFile) {
    if ($scope.isDetail) {
        alert("查看详情无法删除文件");
    }
    var allFile = $scope.allAddressList;
    var allFileName = $scope.allFileNameList;
    var addreddAndName = laFileUploadService.removeFilePath(removeFile, allFile, allFileName);
    $scope.allAddressList = addreddAndName[0];
    $scope.allFileNameList = addreddAndName[1];
};

打开所要上传的文件

//打开所要上传的文件
$scope.openAddress = function (Address) {
    window.open(Address);
};

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值