Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_firebase_storage

Plugin, ACE table, Discussion thread
Dependence:
rex_firebase_apiV3


Introduction
File storage in firebase serivice (v3.x only).

Usage
Security rules
User might configure the security rules of firebase storage before using it, see this page for more detail.

Upload
Call one of these actions to upload data into a storage reference
  • Action:Upload from data URL (sample capx)
  • Action:Upload from sprite (sample capx)
  • Action:Upload from file chooser (sample capx)
On uploading completed
"Condition:On upload complete" will be triggered while uploading completed, get download url of this file by "Expression:LastDownloadURL"
On uploading failed
"Condition:On upload error" will be triggered while uploading failed, get error message by "Expression:LastErrorCode", "Expression:LastErrorMessage".
On uploading
"Condition:On upload progress" will be triggered during uploading, get progress percentage by "Expression:Progress", or get the transferred bytes and total bytes by "Expression:TransferredBytes", "Expression:TotalBytes".
"Condition:Is uploading" will return true when uploading.
Pause, resume or cancel
Call "Action:Pause", "Action:Resume", "Action:Cancel" to control current uploading task.

Download
Call "Action:Get download url" to get a url of the file.
"Condition:On get download URL" will be triggered while getting url, the result url  is put in "Expression:LastDownloadURL"
"Condition:On get download URL error" will be triggered while getting url failed. "Condition:File doesn't exist" will return true under this error triggered while the file does not exist under this storage reference. Get error code by "Expression:LastErrorCode".
Access control allow origin
There might have "access control allow origin" problem if load image from result url in sprite object. Follow this reference to solve it.
  1. Install gsutil
  2. Add cors.json file in local, for example, put in d:\cors.json
  3. Type command "gsutil cors set d:\cors.json gs://exampleproject.appspot.com" in command line window. Replace exampleproject.appspot.com by your storageBucket link.
Example of cors.json, replace * by your domain of application.

    

Delete
Call "Action:Detete" to delete file at a specific storage reference.
"Condition:On deleted" will be triggered while deleting action completed, otherwise "Condition:On deleted error" will be triggered. Get error code by "Expression:LastErrorCode"

Multiple files uploding
Project could have many rex_firebase_storage object for each data.

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About