我使用asp.net mvc和webapi在google驱动器上保存图像文件。我想要完整的图像路径。获得完整路径的替代方案是什么?
我在Webapi中的方法:
private void UploadImage(DriveService service, string imageId)
{
string FOLDER_NAME = "ProductImages";googleFile.File folder = searchFolder(service,FOLDER_NAME);if(folder == null)
folder = createFolder(service,FOLDER_NAME);
var folderId = folder.Id;
var fileMetaData = new googleFile.File();
//fileMetaData.Name = Path.GetFileName(imageId);--not getting full path
fileMetaData.Name = imageId;
fileMetaData.MimeType = "image/jpg";
fileMetaData.Description = "Upload Image";
fileMetaData.Parents = new List<string> { folderId };
FilesResource.CreateMediaUpload request;
// imageId = @"D:\Camera\IMG_20130525_220410.jpg";
using (var stream = new FileStream(imageId, FileMode.Create))-- i get wrong path in imageid.due to that i get error
{request = service.Files.Create(fileMetaData, stream, "image/jpg");
request.Fields = "id";
var upload = request.UploadAsync();
var file = request.ResponseBody;}