Creates a new MultipartFile from a path to a file on disk.
filename defaults to the basename of filePath. contentType currently
defaults to application/octet-stream, but in the future may be inferred
from filename.
This can only be used in an environment that supports "dart:io".
Source
static Future<MultipartFile> fromPath(String field, String filePath,
{String filename, MediaType contentType}) async {
io.assertSupported("MultipartFile.fromPath");
if (filename == null) filename = path.basename(filePath);
dynamic file = io.newFile(filePath);
int length = await file.length();
ByteStream stream = new ByteStream(DelegatingStream.typed(file.openRead()));
return new MultipartFile(field, stream, length,
filename: filename,
contentType: contentType);
}