Currently we are able to drag and drop the folders and we are able to get all the files in the folder.
but we are not able to get the path of that files.
How can we get the file path of the files which are uploaded, so that we can maintain the same folder structure ?
In response from filepicker you receive list of objects.
Each object looks like this:
{
"url":"https://www.filepicker.io/api/file/0SIihoHPT8ORvwQ3EOPx",
"filename":"filepicker_test.png",
"mimetype":"image/png",
"size":4607,
"id":4,
"path":"/2/folder/filepicker_test.png",
"isWriteable":true
}
So you can restore directories structure using "path" key from filepicker answer.
Related
I hope you guys keep health and keep strong in Pandemic covid-19.
I have some question on Azure Data Factory. btw I have create some pipeline with Metadata activity with detail below:
I have file in Folder and Subfolder like this:
I have metadata activity with for each with first get metadata child item (in folder) like this:
metadata with last modified like this (if you setting like this, metadata only read last modified subfolder
after that add variable I use #item().Name to read file in that folder like this:
after running metadata which have subfolder, I've get error like this:
the error give info that with #item().Name cannot read subfolder on that folder. the metadata for each file is success, but error like this which on my activity cannot read metadata subfolder .
many big thanks to have answer, Thank You
If you need to access the folder
Create a clone of same dataset and setup parameter as below, leave the file field empty.
If you need to access the file inside directory, use condition #equals(item().type,'Folder') to identity directory then inside that use dataset with parameters for directory and file.
For example, my podcast app has a list of all downloaded podcast, how do I get a list of all LockCachingAudioSource that has been downloaded using request() method?
When you create your LockCachingAudioSource instances, you can choose the location where you want them to be saved. If you create a directory for that purpose, you can obtain a directory listing using Dart's file I/O API. The directory listing will also show partially downloaded files and other temporary files, which you want to ignore. These have extensions .mime and .part.
Having explained that, here is a solution. First, create your cache directory during app init:
final cacheDir = File('/your/choice/of/location');
...
await cacheDir.create(recursive: true);
Then for each audio source, create it like this:
import 'package:path/path.dart' as p;
...
source = LockCachingAudioSource(
uri,
cacheFile: File(p.joinAll([cacheDir, 'yourChoiceOfName.mp3'],
);
Now you can get a list of downloaded files at any time by listing the cacheDir and ignoring any temporary files:
final downloadedFiles = (await _getCacheDir()).list().where((f) =>
!['mime', 'part'].contains(f.path.replaceAll(RegExp(r'^.*\.'), '')));
If you need to turn these files back into the original URI, you could either create your own database to store which file is for which URI, or you choose the file name of each of your cache files by encoding the URI in base64 or something that's reversable, so given a file name, you can then decode it back into the original URI.
I have a folder in a document library and that contains subfolders and each subfolder contains files.
I want to retrieve all the files in these subfolders using REST. I know how to get the files in each folder but is there any way to get all these files in one REST call... Any help?
You could use the below endpoint to retrieve all files in a library:
/_api/web/lists/getbytitle('Documents')/items?$expand=File&$select=File&$filter=FSObjType eq 0
'pickAndStore' method allows me to specify full path to the file, but I don't know it's extension at this point (file path has to be defined before file is uploaded, so it's not possible to provide a path with correct extension).
if I use 'pick' and then 'store' I have 2 files (because both methods uploads file to the s3). I can delete 'old' file, but it's not optimal and can be pain (take ages) with really big files.
Is there any better solution? Ideally to rename existing file.
Currently, there is no workaround for renaming file.
However, in our Javascript API v2 we are planing to add new callback function. onStart callback will be fired after user pick file but before file uploading. There could be option like renaming file based on original filename.
We will keep you updated.
I'm working on a application that downloads some files to the local storage for caching. The files online are sometimes in 3 or 4 nested folders and I would like to also keep this hierarchy in my cache folder.
Is there no easy way other then having to (await (await folder.GetFolderAsync("dir1")).GetFolderAsync("dir2)) and so on? Now it's hardcoded with dir1 and dir2.
What's the easiest way when the file path is a string like "MyFolder/OtherFolder/lastFolder/file.xml"?
The static member function StorageFolder::GetFolderFromPathAsync can be used to get a StorageFolder object for a folder given its path.