Js 將圖片的絕對路徑轉換為base64編碼(3)


圖片文件改變一方法:
$('#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);
});


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM