2017-03-01 33 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作爲參數。

我希望這會有所幫助。