Files storage in firebase.
Categories > Firebase > rex_firebase_storageIntroductionLinksDependenceUsageFileUploadBrief flowComplete flowMultiple files uplodingDownloadAccess control allow originDeleteMetadataSet valueCustom metadataGetUpdateSecurity rules
Uploading
Action:Upload from data URL (sample capx)Action:Upload from sprite (sample capx)Action:Upload from file chooser (sample capx)Callback
Success : Condition:On complete
Expression:LastDownloadURL
Expression:LastMetadata, returns metadata in JSON string
Expression:LastMetadata( key ), returns a keyExpression:LastMetadata( key, defaultValue ), retruns defaultValue if key is not existedFailed : Condition:On error
Expression:LastErrorMessage, Expression:LastErrorCode (reference)State: Idle
Upload starting
Action:Upload from data URL (sample capx)
Action:Upload from sprite (sample capx)
Action:Upload from file chooser (sample capx)
Parameter Metadata
Condition:On starting
Expression:Progress, Expression:TransferredBytes, Expression:TotalBytesGo to State: Uploading
State: Uploading
Failed event
Condition:On upload error
Expression:LastErrorMessage, Expression:LastErrorCode (reference)Expression:Progress, Expression:TransferredBytes, Expression:TotalBytesGo to State: Idle
Completed event
Condition:On upload complete
Expression:LastDownloadURL
Expression:LastMetadata, returns metadata in JSON string
Expression:LastMetadata( key ), returns a keyExpression:LastMetadata( key, defaultValue ), retruns defaultValue if key is not existedExpression:Progress, Expression:TransferredBytes, Expression:TotalBytes
Go to State: Idle
Action:Cancel
Condition:On canceled
Expression:Progress, Expression:TransferredBytes, Expression:TotalBytesGo to State: Idle
Action:Pause
Condition:On paused
Expression:Progress, Expression:TransferredBytes, Expression:TotalBytesGo to State: Paused
Condition:On upload progress
Expression:Progress, Expression:TransferredBytes, Expression:TotalBytesCondition:Is uploading returns true
State: Paused
Action:Resume
Condition:On resmue
Expression:Progress, Expression:TransferredBytes, Expression:TotalBytesGo to State: Uploading
Put or create this rex_firebase_storage object for each file uploading.
Follows these steps to allow loading images to sprite from firebase storage.
Add cors.json file in local (d:\cors.json)
xxxxxxxxxx[ { "origin": ["*"], "method": ["GET"], "maxAgeSeconds": 3600 }]replace * by your domain of application.
Type command
gsutil cors set d:\cors.json gs://exampleproject.appspot.com
in command line window. Replace exampleproject.appspot.com by your storageBucket link.
Action:Detete
Callback
Success : Condition:On deleted
Failed : Condition:On deleted error
Expression:LastErrorMessage, Expression:LastErrorCode (reference)set metadata before uploading file.
Action:Set valueAction:Remove keyAction:Load JSONMetadata will be cleaned after uploading.
Custom metadata is an object containing string->string mappings. For example,
Set `customMetadata.version to 0.1.3.4 will add key version, value 0.1.3.4 in customMetadata.
Action:Get metadata
Callback
Success : Condition:On get metadata
`Expression:LastMetadata, returns metadata in JSON string
Expression:LastMetadata( key ), returns a keyExpression:LastMetadata( key, defaultValue ), retruns defaultValue if key is not existedFailed : Condition:On get metadata error
Expression:LastErrorMessage, Expression:LastErrorCode (reference)Action:Update metadata
Callback
Success : Condition:On get metadata
`Expression:LastMetadata, returns metadata in JSON string
Expression:LastMetadata( key ), returns a keyExpression:LastMetadata( key, defaultValue ), retruns defaultValue if key is not existedFailed : Condition:On get metadata error
Expression:LastErrorMessage, Expression:LastErrorCode (reference)