0
我是新的角度和使用github上的角度文件上传项目https://github.com/danialfarid/angular-file-upload 在我的应用程序之一。到现在为止,后端没有准备好,我希望删除的文件在本地显示在浏览器中。有没有办法做到这一点?如何在浏览器中本地保存拖动的图像
我的视图代码:
<div ng-controller="MyCtrl">
<input type="file" ng-file-select="onFileSelect($files)">
<div class="button" ng-file-select="onFileSelect($files)" data-multiple="true"></div>
<div id="image_drop_box" ng-file-drop="onFileSelect($files)" ng-file-drag-over-class="optional- css-class-name-or-function" ng-show="dropSupported">drop files here</div>
<div ng-file-drop-available="dropSupported=true" ng-show="!dropSupported">HTML5 Drop File is not supported!</div>
<button ng-click="upload.abort()">Cancel Upload</button>
</div>
和逻辑控制器看起来如下:
.controller('MyCtrl', function($scope){
$scope.onFileSelect = function($files) {
//$files: an array of files selected, each file has name, size, and type.
for (var i = 0; i < $files.length; i++) {
var file = $files[i];
$scope.upload = $upload.upload({
//upload logic
});
}
};
});
可以以base64字符串可能存储在[Window.sessionStorage] (http://www.w3schools.com/html/html5_webstorage.asp) – 2014-09-02 13:53:14