【发布时间】:2015-08-02 15:11:17
【问题描述】:
我正在使用这个照片上传指令来上传图片:
https://github.com/danialfarid/ng-file-upload
$scope.upload = function (files) {
if (files && files.length) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
Upload.upload({
url: 'https://angular-file-upload-cors-srv.appspot.com/upload',
fields: {
'username': $scope.username
},
file: file
}).progress(function (evt) {
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
$scope.log = 'progress: ' + progressPercentage + '% ' +
evt.config.file.name + '\n' + $scope.log;
}).success(function (data, status, headers, config) {
$timeout(function() {
$scope.log = 'file: ' + config.file.name + ', Response: ' + JSON.stringify(data) + '\n' + $scope.log;
});
});
}
}
};
我需要添加从剪贴板“粘贴”图像的功能,并通过 ng-file-upload 上传。
谁能指点我如何做到这一点?
【问题讨论】:
-
查看
contenteditable属性,看看您是否可以提出解决方案。下面是一些开始:html5doctor.com/the-contenteditable-attribute
标签: javascript angularjs browser