locked
copying an user's file from Documents to App's private folders RRS feed

  • Question

  • Hello, I would like to know if it is possible to copy an user's file from its Documents folder to some private folder of the application so it sees the file like it was a file in the package. Any suggestion or idea is appreciated. Thanks in advance.
    • Edited by P5music Friday, April 6, 2012 9:33 AM
    Friday, April 6, 2012 9:33 AM

Answers

All replies

  • What's your use case scenario?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Friday, April 6, 2012 8:06 PM
    Moderator
  • My goal is to put an user's  html file temporarily inside the private folders of the App, from where security restrictions to loading are not enabled, like loading the html file into a iFrame. 
    Saturday, April 7, 2012 12:08 PM
  • storageFile.copyAsync(destinationFolder, "newFileName").done(function() { });

    In the snippet above, storageFile is the StorageFile you have obtained and wish to copy and destinationFolder is the StorageFolder you have obtained and wish to copy to.

    Justin Cooperman

    Monday, April 9, 2012 8:22 AM
  • Is 

    WinJS.Application.local.folder (or something similar)

    an accepted value for destinationFolder?

    Monday, April 9, 2012 9:51 AM
  • See the documentation here for the application data localFolder options:

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.aspx

    temporaryFolder may be a better option for you if you are not intending on persisting this.

    You can load any HTML as unsafe as well, so copying it is not necessary:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx

    Do this judiciously however as you open your app as a potential security hole for a customer.

    -Jeff


    Jeff Sanders (MSFT)

    Monday, April 9, 2012 12:41 PM
    Moderator