2017-03-01 89 views
0

我有一个WebApi项目和一个Android客户端,我需要使用App42从WebApi上传一些图片,问题是,在this教程中,它必须有一个StringPath,但我没有一个stringPath,因为该图像将由Android Client发送给Api,然后保存这些图像。我是否必须将Android中的图像作为Base64发送,然后创建一个tempFileObject作为位图,然后将字符串路径?如何使用App42上传图像

String name = "MyPic";  
String userName = "Nick";  
String filePath = " file path from gallery /sd card"; 
String fileType = "IMAGE";  
String description = "This is my holiday pic"; 
Upload upload = uploadService.UploadFileForUser(name,userName,filePath,fileType,description);  
// File will get uploaded in App42 cloud with above snippet.  
IList<Upload.File> fileList = upload.GetFileList(); // This will have only single file uploaded above 
for (int i = 0; i < fileList.Count; i++)  
{  
    Console.WriteLine("fileUrl is " + fileList[i].GetUrl());  
    //This will return uploaded file URL 
} 

回答

0

如果我了解查询,那么您没有将文件保存在设备本地文件存储中。如果是,那么您可以使用another API这会询问图像的InputSteam作为参数。

我希望这会有所帮助。