I am creating a (sort-of) downloading manager for windows 8 as a metro app. I need to let the user pick his download directory.
So we can get a reference to a folder using the folder picker:
Windows.storate.Pickers.FolderPicker.pickSingleFolderAsync.then(function (folder)
{
//myFolder
folder
}
Now my question is how would I save this folder reference, so that I can still access it after the user closes the app?
There seems to be applicationData that we can use, but does that keep the folder permission in-tact?
I'm using HTML+JS, though since this is an API question it doesn't really matter.
The recommended way to keep track of the folder is to use the AccessCache APIs, which will keep track of the files and folders your app has been given permissions for from the pickers.
To store a folder in the cache:
var folder = //Get a folder from the picker
var storageItemAccessList = Windows.Storage.AccessCache.StorageApplicationPermissions.futureAccessList;
storageItemAccessList.Add(folder,"identifyingString");
And to get the same folder out of the cache later use GetFolderAsync with the identifying string that you used when you stored the folder.
Note that the folder will be kept in the cache even if it has been deleted on the disk. You will get a FileNotFound exception when you try and open it though.
Related
I can store files to the specified storage location via the GUI. I can see the files are in the storage location.
When I try to download them using the GUI, I get this every time.
{"error":{"code":3,"message":"Unauthorized request","class":"Directus\\Exception\\UnauthorizedException","file":"\/var\/www\/directus\/src\/helpers\/app.php","line":287}}
When I try the links from the File library, I get the same error.
I found some old topics concerning a "_" project. I do not see any "_" entries in my project.php configuration.
Everyone has read permissions for the storage directory.
The rest of the system appears to run without error.
check the folder in the server and what is been set, the default should be, like
So then if you want to access the 300x300 the URL should be like:
domain.com/public/uploads/Directus/generated/w300,h300,fcrop,q80/file-name.jpg
How do I change directory folder in system watcher?
I made a desktop app to upload file in database.
I set the root folder as C:\Users\x\Desktop\Test.
A user can copy/paste a file into that folder and that file will upload to database.
but sometimes, a user can upload not in that root folder. user can upload file to other folder in root.
Let's say in the root folder, there are folders called Hello and Hallo..
the user clicks on the folder Hello, directory change not C:\Users\x\Desktop\Test again but C:\Users\x\Desktop\Test\Hello
My question, how can I detect it?
Because system watcher can only handle created, changed, deleted, renamed. So I must change or create file first to get e.fullpath.
I want that if I click folder Hello, I get e.fullpath :)
Set the IncludeSubdirectories property on your FileSystemWatcher to true, e.g.:
fsw.IncludeSubdirectories = True
Ref: http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.includesubdirectories(v=vs.110).aspx
just wondering if it's possible to include some files (one txt file in this case) in the app package that I need in the application folder. The thing is that I might use a piece of code that requires the license to be included in the app as a text file, and I think this would be one way to do it.
Thanks in advance.
Absolutely, it's really no different than including images for instance. And if you need to process the file within your app you can access it via its local path or explicitly use the ms-appx:/// protocol.
See How to reference content and How to load file resources for more details.
Just include the file in your project with Build Action set to Content. You can put it in any folder you like.
The file can then be accessed from the app either using the ms-appx: protocol or using the StorageFolder API:
var license = await Package.Current.InstalledLocation.GetFileAsync("license.txt");
just starting at play, and I needed to see it it can be used to do my project.
But after reading some docs, I still can't find a way to put uploaded files in more then one place.
I know that there is the attachments folder, and that I can change it directory in the confs, but what I want is another attachments folder, some thing like:
If the user upload a photo it would go to /photos folder;
if the user upload a txt it would go to /docs fodler;
Thanks
--UPDATE--
I'm using Play 2.0.1
So after some more research I found this other question:
How can I change uploaded files directory in play 2.0.1?
Basically there is no more attachments path configure in this playframework version, so I need to put this manually in the control, just like the answer in that question.
I have added some files that I need to be downloaded to the Application start up path. So I set Build Action as content now the files have been copied some where
C:\Documents and Settings\TestUser.ANNAM\Local Settings\Apps\2.0\Data\HVDRBMY5.8AA\858AT9VM.TNP\test..tion_2d7cfc137d9c2c74_0001.0013_432bd4561850d290\Data
How can access file from the application. My problem since it is a dynamic path will it be same folder count so that we can use like ....\Data\ Some think like this
You can use My.Application.Info.DirectoryPath this will return the directory where the application is stored.