We have a Java (JSP) application and I want (well, the client) wants when they save a file from the system, the file to be downloaded automatically by default in the USB drive. Also the same for when they are uploading any files to the system.
I know that this is not possible due to security reasons but I recently saw about this File System Access API and I am trying to understand what is possible.
Well, apparently for Downloading we can use
async function fileOpen() {
const fileHandle = await window.showOpenFilePicker({
startIn: 'documents'
});
}
but in the startIn
property whenever I try setting D:\
or anything other than the WellKnownDirectories
I get the error:
TypeError: Failed to execute 'showOpenFilePicker' on 'Window': Failed to read the 'startIn' property from 'FilePickerOptions': The provided value 'D:\' is not a valid enum value of type WellKnownDirectory.
So is something like that possible? What about when uploading a file? The file picker that opens from the <input type=file>
doesn't support setting any value for the default directory.
Keep in mind the this is a controlled environment and the existence of the D:
drive is ensured
Is there maybe any other way, other than JavaScript?
from Can I set a specific drive (e.g,"D:\") as a default directory for showOpenFilePicker?
No comments:
Post a Comment