Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 1.19 KB

storage.md

File metadata and controls

28 lines (24 loc) · 1.19 KB

Storage

brain-dump

flow

return [loading, error, {
  spreadToInput, // object to spread on the input, has type, onChange
  spreadToSubmit, // object to spread on submit button to submit added file, disabled until file is added
  uploadFunction, // simple function thats a part of the spreadToSubmit that purely uploads the files, useful when not wanting to add a submit button
  progress, // an object with status of whats happening, read here
}] = useStorage(
  'path',
  { // all of these are optional
    accept: ['.jpg', 'image/*'], // and all the other types - more info [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers)
    capture: 'accept' | 'user' | 'environment',
    multiple: true | false,
    metadata: {
      // all of the metadata that the user might want to attach to the file, here are docs in FB https://firebase.google.com/docs/storage/web/upload-files#add_file_metadata
    }
  }
  )