c# - OneDrive Downloaded *.jpeg Image File Corrupt in Windows Phone 8 -


itemprop = "text">

I'm backing OneDrive of my app database, I refers to database record image that is stored in separate storage. I also back up those pictures database files

are the destination of the backup file:

  me / skydrive / my_documents / MyCompany / MyApp / MyBackup.bak   

The destination of JPG image files

  me / skydive / my_dount / miconline / my app / mybackup images / *. Jpg   

Database fixes, but no image I have verified that the image has been properly backed up on SkyDrive - I can see it and open it properly with SkyDrive Can i However, when I restore, the file is corrupted. Here is the code to use to restore:

  dynamic cmpFolder = accumulation Fundfolder ("micropany", "m / skydive / my_deaduments"); Dynamic Appfolder = One Drive. Awaiting fundfölder (apn, simpflader.id); String imagesfilename = path.gatefileNameAddressed person (selected file.filename) + "picture"; Awaiting dynamic imgFolder = oneDrive.FindFolder (imagesFileName, appFolder.id); Dynamic filelist = single drive Awaiting feeds (imgflader.id); Foreach (var fileData in fileList.data) {string fileName = fileData.name; Var file = wait wilFolder.CreateFileAsync (Path.GetFileName (filename), CreationColisionOption.ReplaceExisting); Var result = waiting for the customer. BackgroundDownloadAsync (Selected File .philif + "/ Content /", New Yuri (@ "\ Share \ Transfer \" + Filename, Urikhind .Relative)); }   

To use ISETool and view shared transactions, I can see that the file is no longer readable. This size is about 128k, while the original image was too big.

I have also tried, which was my original code until I see the problem:

  var downloadResult = Wait for the client. Download ASINCC (selected file.file ID + "/ content /"); (OneDriveStream = downloadResult.Stream Stream) using {oneDriveStream.Position = 0; Byte [] imageBytes = new byte [oneDriveStream.Length]; int count = oneDriveStream.Read (imageBytes, 0, imageBytes.Length); (Var s = await file.OpenStreamForWriteAsync ()) using {oneDriveStream.CopyTo (S); // and tried this //s.Write (images, 0, imageBytes.Length); }}   

For reference, here is FindFolder and FindFiles implementation:

  public async works & lt; Dynamic & gt; FindFiles (string folder name) {LiveOperationResult filesResult = Wait for client. GetAsync (folder name + "/ files"); Dynamic Files = Files Results result; Return files; } Public async works & lt; Dynamic & gt; FindFolder (string folder name, string parent folder) {LiveOperationResult folder Result = client.GetAsync (parentFolder + "/ files? Filter = folders"); Dynamic folders = folder result result; Foreach (Folders.data var folder) if (folder.name == folderName) return folder; Return tap; }   

How can I download * .jpg images successfully from my OneDrive folder?

Instead try this for your download path:

  wait for var downloadResult = client. Download ASINC (Selected file .philif + "/ photo? Type = full");    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -