Angularjs多文件上传

时间:2017-02-18 10:59:58

标签: angularjs

<input file-model="ad.File"
                 type="file"
                 class="form-control"
                 ng-required="true"
                 name="file"
                 ng-show="ad.Type"/>

我的项目坚持使用angularjs上传多个文件一个文件上传工作正常,但我无法上传多个文件。搜索得很好但无法找到解决方案。

2 个答案:

答案 0 :(得分:1)

您的文件输入缺少multiple属性。它应该是:

 <t:TreeTable id="idProductionTable" rows="{path:'/Rowset/Row/root/', parameters: {arrayNames:['/children']}}">

                        <t:toolbar>
                            <Toolbar>
                                <Title text="Production"/>
                            </Toolbar>
                        </t:toolbar>
                        <t:columns>
                            <t:Column width="130px" demandPopin="true" id="idProdReportNode" showSortMenuEntry="false"
                                                     minScreenWidth="Tablet">
                                <Label text="NAME" design="Bold" class="TableLabelColor" />
                                <t:template>
                                    <ObjectIdentifier text="{@name}" />
                                </t:template>
                            </t:Column>
                            <t:Column width="130px" demandPopin="true" id="idProdReportProdCount" showSortMenuEntry="false"
                                                    minScreenWidth="Tablet" hAlign="End">
                                <Label text="Level" design="Bold" class="TableLabelColor" />
                                <t:template>
                                    <ObjectIdentifier text="{@level}" />
                                </t:template>
                            </t:Column>
                        </t:columns>
                    </t:TreeTable>

答案 1 :(得分:0)

尝试此操作并选择多个文件。

&#13;
&#13;
<!DOCTYPE html>
<html ng-app="UserValue">
<head>
	<script type="text/javascript" src="https://code.angularjs.org/1.5.5/angular.min.js"></script>
	<script type="text/javascript">
		var app = angular.module('UserValue', []);
		app.controller('UserFirstValue', function ($scope) {
			
});
</script>
</head>
<body ng-controller="UserFirstValue">

<input type="file" ng-file-model="files" multiple />
    <button type="button" ng-click="upload()">Upload</button>
</body>
</html>
&#13;
&#13;
&#13;