0
此代码运行良好:谷歌驱动器,上传的MemoryStream
img.Save("111.png", System.Drawing.Imaging.ImageFormat.Png);
using (MemoryStream fileStream = new MemoryStream(System.IO.File.ReadAllBytes("111.png")))
{
FilesResource.InsertMediaUpload request = _drive.Files.Insert(item, fileStream, mimeType);
request.Upload();
}
但是当我尝试上传System.Drawing.Image
收到MemoryStream
,我得到一个谷歌例外: 'The given header was not found.'
代码:
System.Drawing.Image img = myImgObj;
using (MemoryStream fileStream = new MemoryStream()))
{
img.Save(fileStream, System.Drawing.Imaging.ImageFormat.Png);
FilesResource.InsertMediaUpload request = _drive.Files.Insert(item, fileStream, mimeType);
request.Upload();
}
任何人都可以帮我修复代码吗?