-1
내 firebase 데이터베이스에 사용자 프로필 사진을 저장해야합니다. 이 경로가있는 로컬 이미지를 저장하려고합니다. "www/img/avatar.jpeg". 나는 이미지 URL로컬 이미지 URL을 firebase에 저장하는 방법은 무엇입니까
$scope.user.image="data:img/avatar.jpeg;base64"
를 얻기 위해이 코드를 시도하지만 내 코드를 실행할 때 나는이 메시지 오류 : ERR_UNKNOWN_URL_SCHEME
합니다. 이 코드의 출처
function handleFileSelect(e) {
var file = e.target.files[0];
// Get a reference to the location where we'll store our photos
var storageRef = storage.ref().child('chat_photos');
// Get a reference to store file at photos/<FILENAME>.jpg
var photoRef = storageRef.child(file.name);
// Upload file to Firebase Storage
var uploadTask = photoRef.put(file);
uploadTask.on('state_changed', null, null, function() {
// When the image has successfully uploaded, we get its download URL
var downloadUrl = uploadTask.snapshot.downloadURL;
// Set the download URL to the message box, so that the user can send it to the database
textInput.value = downloadUrl;
});
}
file.addEventListener('change', handleFileSelect, false);
:
<input type="file" id="file" name="file" />
그런 다음 당신이 자바 스크립트를 처리 할 수 있습니다 : 당신이 당신의 HTML에서 파일 선택이 필요하므로