By default, the type property of the passed-in source is used as the content type but can be overridden using options. If source is a Blob, be sure to specify a filename in the options. For File objects, the filename falls back to “File#file”.
Note: This method does not perform the actual upload but returns a FutureBinary. The actual upload can be triggered by putting the FutureBinary into an Obj.
Params
source(Blob or File) - Local data that can be uploaded to aBinaryoptions(optional) (Object) - Options to pass when uploading aBinaryfilename(String) - The file name to use for the newBinary; mandatory for blobs.contentType(String) - A content type for overriding the type of thesource.
Throws
ArgumentError- If the source is neither a Blob nor a File.ArgumentError- If any of the passed-inoptionsare blank.ArgumentError- Ifsourceis a “Blob” and nofilenameis given.
Returns
FutureBinary