Upload files to Cloud Storage from WordPress

Dale Nguyen
ITNEXT
Published in
2 min readAug 2, 2020

--

If you are interested in the Integrate Firebase PRO version, read the full updated documentation: https://firebase-wordpress-docs.readthedocs.io/

Demo: https://wordpress.dalenguyen.me/

Upload files from WordPress to Cloud Storage is similar to Save Data from WordPress to Firebase. Everything can be done through Contact Form 7. However, you can design your custom form to suit your needs.

Enable Cloud Storage

In the general tab, you have to add the Storage Bucket from your firebase project, then check the option for Storage under Firebase Services.

Enable Cloud Storage

Upload Files to Cloud Storage

This is an example of Contact Form 7 from uploading images to Cloud Storage and save the path to firestore.

// This form will create a path of the file to "users" collection
// If you want to generate a random id, you can leave out the documentId
// The file will be uploaded to "wpImages/documentId/timestamp+filename" path under Storage

[hidden collectionName "users"]
[hidden documentId "some-random-id"]
[hidden databaseType "firestore"]
[hidden fileType "imageUrl"]

[file imageUrl limit:1mb filetypes:gif|png|jpg|jpeg]

[submit "Upload File"]

After submitting the file, it will be uploaded to Cloud Storage under wpImages/som-random-id path. The image name will be prefixed with a timestamp.

Image path in Cloud Storage
Image path in Firestore

--

--