April 2018
Intermediate to advanced
284 pages
6h 43m
English
When you upload a file, you can also store some metadata for that file, such as Content-Type or name.
You can create a JSON object with key: value pairs and pass that object when you upload the file. For custom metadata, you can create an object inside the metadata object, as shown here:
// Create file metadata including the content typevar metadata = { contentType: 'image/jpeg', customMetadata: { 'ticketNo':'12345' }};// Upload the file and metadatavar uploadTask = storageRef.child('folder/file.jpg').put(file, metadata);