5

So I'm using firebase storage to upload my website files. Here is an example of the directory structure:

Project
├── index.html
├── css
│   └── style.css
└── js
    └── mainScript.js

So I'm uploading these files to firebase in this structure, but I notice that the downloadURL that's returned is not very friendly in preserving this structure..

For example, when I set the src of an iframe to the downloadURL for the index.html.. the iframe page is missing the style and mainScript files.

This is how the downloadURL looks for index.html:

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/index.html?alt=media&token=some_uid

This is how the downloadURL looks for style.css:

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/css%2Fstyle.css?alt=media&token=some_uid etc..

Of course the index.html file is looking for the style.css file at:

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/css/style.css

but results in 404.

Is there a way around this problem?

PS, Of course I don't want to force the user to change the urls in their files...

Bitswazsky
  • 4,242
  • 3
  • 29
  • 58
Pius Nyakoojo
  • 106
  • 1
  • 10
  • 1
    I am in the very same situation, wanting to upload a Unity WebGL game into storage and loading it into an iFrame, but because of this weird URL random generation, file tree is broken and the iFrame cannot load. It's a pity since AWS allows thats properly for ages. Have you figured a solution ? – Kamalen Aug 01 '16 at 22:11

1 Answers1

1

Don't use the storage to save your website files! Use Firebase hosting instead ... Firebase storage is designed for storing upload/download files (image, audio, etc.)

https://firebase.google.com/docs/hosting/

vidriduch
  • 4,753
  • 8
  • 41
  • 63
  • 6
    My intention isn't to store my own website files.. I'm trying to allow users of my website to upload their own website (of course without server-scripts.. well with Firebase api that kind of blurs the line but probably you know what I mean) Basically, my assumption with Firebase Storage was that it would be like Firebase Hosting except we can access the storage programmatically rather than just through CLI.. – Pius Nyakoojo Jul 02 '16 at 07:23