Adding file metadata

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 type
var metadata = {
contentType
: 'image/jpeg',
customMetadata: {
'ticketNo':'12345'
}
};

// Upload the file and metadata
var uploadTask = storageRef.child('folder/file.jpg').put(file, metadata);
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset