2013-12-11 189 views
0

我想將文檔保存在保存箱中,我已將文檔保存在設備上。以及從我的應用程序保存在保管箱中的UIImage。如何將圖像或文件保存到保存箱中xamarin?

DBError error; 

     string ruta = Environment.GetFolderPath (Environment.SpecialFolder.Personal); 
     string rutaarchivo = Path.Combine(ruta,"Geodesia.xml"); 
     DBPath newPath = DBPath.Root.ChildPath(rutaarchivo); 
     DBFile archivo = DBFilesystem.SharedFilesystem.CreateFile (newPath,out error); 

我使用此代碼,但只創建該文件,有人幫助我?

回答

0

根據Dropbox API Documentation,CreateFile只能打開文件。您需要使用WriteContentsOfFile將其他文件的內容複製到該文件中。

例如:

archivo.WriteContentsOfFile(rutaarchivo, false); 
+0

感謝您的幫助,我發現另一種方法我用圖像archivo.WriteData(Image.AsPNG(),超時錯誤)的代碼;這對於文件archivo.WriteData(rutaarchivo,out error);祝你今天愉快!! –