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 aBinary
options
(optional) (Object) - Options to pass when uploading aBinary
filename
(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-inoptions
are blank.ArgumentError
- Ifsource
is a “Blob” and nofilename
is given.
Returns
FutureBinary