我最近写了一条指令,支持本地多个文件上传。我创建的解决方案依赖于服务来填补$
http服务所标识的空白。我还包含了一条指令,该指令为您的angular模块提供了一个易于使用的API,用于发布文件和数据。
用法示例:
<lvl-file-upload auto-upload='false' choose-file-button-text='Choose files' upload-file-button-text='Upload files' upload-url='http://localhost:3000/files' max-files='10' max-file-size-mb='5' get-additional-data='getData(files)' on-done='done(files, data)' on-progress='progress(percentDone)' on-error='error(files, type, msg)'/>
您可以在github上找到代码,并在我的博客上找到文档。
您可以在Web框架中处理文件,但是我创建的解决方案提供了将数据获取到服务器的角度接口。您需要编写的角度代码是对上传事件的响应
angular .module('app', ['lvl.directives.fileupload']) .controller('ctl', ['$scope', function($scope) { $scope.done = function(files,data} { }; $scope.progress = function(percentDone) { }; $scope.error = function(file, type, msg) { }; $scope.getAdditionalData = function() { }; });
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)