According to this article, we only have write access to the Downloads folder - this seems to be supported by what I've found. Is there any way around this in WinRT? I want to be able to iterate through the files in the downloads folder.
Here's the official documentation on the subject:
All apps can create files and folders in the Downloads folder and can
access the files that they create. But apps can't access files in the
Downloads folder that they didn't create.
When your app creates a file in the Downloads folder, other apps can't
interfere with or access your file unless the user explicitly gives
the other app access. The user can give another app access to your
file by selecting the file from the file picker. Your app can also use
the file picker to get access to the files in the Downloads folder
that it didn't create.
So, no: there's no way to enumerate or iterate through all the files in the folder without user intervention. You could it, though, if you get the user to select the folder with a FolderPicker:
var picker = new FolderPicker();
picker.FileTypeFilter.Add("*");
var folder = await picker.PickSingleFolderAsync();
foreach (var file in await folder.GetFilesAsync())
{
// do something with each file
}
After you get the reference to StorageFolder you can even store it in MostRecentlyUsedList so that you can access it in the future without the user having to select it again:
var token = StorageApplicationPermissions.MostRecentlyUsedList.Add(folder);
You only need to store the returned token to get access to it again:
var folder = await StorageApplicationPermissions.MostRecentlyUsedList.GetFolderAsync(token);
Related
We are using express-fileupload to uploading file on express project. Currently with some special case we want to add more file into request with some url. We create a new middleware to attach new file into request.files but not success.
We are building an application using onedrive api v2.0.
But we are unable to see/access folders which are shared to user by any other users while making a request to /me/drive/root/children.
Can someone please suggest how to access folders which are shared by someone as our api will further create folders, files in these shared folder.
Shared files don't show up in the user's drive (/me/drive/root in your example) but are available through the sharedWithMe view:
GET /drive/sharedWithMe
This returns a collection of items that have been shared with the owner of the drive (or the current user in this case). Each item returned will include the remoteItem property which contains a reference to the actual item. If you want to access the actual item, then you need to build a request like this:
GET /drives/{item.remoteItem.parentReference.driveId}/items/{item.remoteItem.id}
Which will access the actual shared item (not the link to the remote item which is returned by sharedWithMe).
There's more information about Shared With Me on the OneDrive dev portal.
The request which was specified by greg works fine. I don't about the scopes specified by gregg, but to access the shared files, you to add the current user through you are making the as secondary administrator to other user ( in this case the user who shared the file) in SharePoint MySite administration.
I suggest to use graph API for accessing files from one drive as the responses are more consistent compared to the response from onedrive api. Though both Ali's require the secondary administrator setting to access the files.
I am using PhantomJS 1.9.7 to scrape a web page. I need to send the returned page content to S3. I am currently using the filesystem module included with PhantomJS to save to the local file system and using a php script to scan the directory and ship the files off to S3. I would like to completely bypass the local filesystem and send the files directly from PhantomJS to S3. I could not find a direct way to do this within PhantomJS.
I toyed with the idea of using the child_process module and pass in the content as an argument, like so:
var execFile = require("child_process").execFile;
var page = require('webpage').create();
var content = page.content;
execFile('php', '[path/to/script.php, content]', null, function(err,stdout,stdin){
console.log("execFileSTDOUT:", JSON.stringify(stdout));
console.log("execFileSTDERR:", JSON.stringify(stderr));
});
which would call a php script directly to accomplish the upload. This will require using an additional process to call a CLI command. I am not comfortable with having another asynchronous process running. What I am looking for is a way to send the content directly to S3 from the PhantomJS script similar to what the filesystem module does with the local filesystem.
Any ideas as to how to accomplish this would be appreciated. Thanks!
You could just create and open another page and point it to your S3 service. Amazon S3 has a REST API and a SOAP API and REST seems easier.
For SOAP you will have to manually build the request. The only problem might be the wrong content-type. Though it looks as if it was implemented, but I cannot find a reference in the documentation.
You could also create a form in the page context and send the file that way.
Hi
i am using apache tomcat.
i have a jsp file for entering user name and password and a java bean for authentication.
after user have been authenticated i create a session variable with the user name and another by the name of "authenticated" with the value true.
i want to allow file download only after the session variable "authentication" == true;
i also want to do some processing before the download (registering the user name who downloaded..)
the problem:
lets say i have the file "download.bin" inside directory "/downloads"
so anyone who go directly to url "downloads/download.bin" will get the file.
1.can i prevent direct download of the file
2. enable the file download only after session authentication.
thanks.
You can prevent the file from being directly downloaded. One common way to do that would be to put your /downloads folder inside of the WEB-INF. Create a servlet which checks your authentication flag and then sends the file to the user.
A users request may look something like the following:
http://localhost/myApp/downloadServlet?filename=download.bin
Since content inside the WEB-INF is not available publicly, you can hide your files there.
I have a file input form that takes images as input. Normally we would send the image to the backend service to store but this time I want to save them into the nuxt static folder. I know its not an good idea to store dynamic files in the frontend. But is there any way I can save the uploaded files into the static folder or anywhere in the frontend with vue and nuxt ?
What you're describing isn't possible. At least not in a user, or developer, friendly way
The static/ folder in Nuxt is only used at build time. Any resources inside it get mapped to the root / of the domain.
You cannot insert files into the static/ folder of an uploaded site.
If you want to serve user uploaded content, after the build has occurred then the file will need to be sent to the backend and stored appropriately depending on your use case.
Otherwise, you will have to re-generate your static site for each piece of user content you add to your local static/ folder.