图片文件改变一方法:
$('#file').change(function(){
var oFReader = new FileReader();
oFReader.readAsDataURL(this.files[0]);
console.log(this.files[0]);
oFReader.onload = function (oFREvent) {
$('#preview').html('<img src="'+oFREvent.target.result+'">');
};
});
});
图片文件改变二方法:
$scope.$watch('files', function (value) {
if(value){
var oFReader = new FileReader();
oFReader.readAsDataURL($scope.files[0]);
oFReader.onload = function (oFREvent) {
$scope.employee.empPhotoPath = oFREvent.target.result.slice(23);
};
}else{
$scope.employee.empPhotoPath = '';
}
// employeeService.uploadEmpPhotoPath(Upload, $scope.files, aflterUpload);
});