File tree Expand file tree Collapse file tree 3 files changed +13
-55
lines changed Expand file tree Collapse file tree 3 files changed +13
-55
lines changed Original file line number Diff line number Diff line change 11{
22 "rules" : {
3- ".read" : " auth != null" ,
4- ".write" : " auth != null"
3+ ".read" : true ,
4+ ".write" : false ,
5+
6+ "posts" : {
7+ ".write" : " auth != null" ,
8+ },
9+
10+ "uploads" : {
11+ ".write" : " auth != null" ,
12+ }
513 }
614}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ export class UploadService {
1111 constructor ( private db : AngularFireDatabase ) { }
1212
1313 private basePath :string = '/uploads' ;
14- private uploadTask : firebase . storage . UploadTask ;
1514 uploads : FirebaseListObservable < Upload [ ] > ;
1615
1716
@@ -34,9 +33,9 @@ export class UploadService {
3433 // Executes the file uploading to firebase https://firebase.google.com/docs/storage/web/upload-files
3534 pushUpload ( upload : Upload ) {
3635 let storageRef = firebase . storage ( ) . ref ( ) ;
37- this . uploadTask = storageRef . child ( `${ this . basePath } /${ upload . file . name } ` ) . put ( upload . file ) ;
36+ let uploadTask = storageRef . child ( `${ this . basePath } /${ upload . file . name } ` ) . put ( upload . file ) ;
3837
39- this . uploadTask . on ( firebase . storage . TaskEvent . STATE_CHANGED ,
38+ uploadTask . on ( firebase . storage . TaskEvent . STATE_CHANGED ,
4039 ( snapshot ) => {
4140 // upload in progress
4241 upload . progress = ( snapshot . bytesTransferred / snapshot . totalBytes ) * 100
@@ -47,7 +46,7 @@ export class UploadService {
4746 } ,
4847 ( ) => {
4948 // upload success
50- upload . url = this . uploadTask . snapshot . downloadURL
49+ upload . url = uploadTask . snapshot . downloadURL
5150 upload . name = upload . file . name
5251 this . saveFileData ( upload )
5352 }
You can’t perform that action at this time.
0 commit comments