How can I upload a file from AngularJS application to Firebase Hosting -


i using firebase hosting host angularjs application. using ng-file-upload grab user-uploaded image form have in application. want store user-uploaded image in folder on firebase hosting. cannot use firebase storage because need pre-determined, direct link image resource in various parts of platform. thought maybe use firebase functions upload file , store in firebase hosting. keep running cross-origin errors.

could explain how structure firebase function can upload image firebase hosting? understand, firebase function not hosted @ same location rest of firebase hosting content, not sure if makes difference.

firebase hosting exclusively versioned, deployed static content. cloud storage firebase right product you. when need "pre-determined direct link" mean need able know url before upload completes? if not, can use getdownloadurl() in firebase cloud storage sdk.

if need know url in advance, following:

  1. upload file cloud storage using firebase sdk.
  2. create cloud function listens uploads.
  3. in function, use gcs node api make object public.

once above, file directly , publicly accessible @ https://<bucket>.storage.googleapis.com/<path_to_object>.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -