We have a Java (JSP) web application and I want (well, the client) wants when they upload a file , based on a specific condition , the file picker to open directly in the D drive root directory. Also when they download a file, the file to be downloaded automatically by default in the same D (USB) drive (not universally through browser settings of course).
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 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? The file picker that opens from the <input type=file>
doesn't support setting any value for the default directory so this is why I am looking at the file system access api.
Keep in mind that this is a controlled environment and the existence of the D:
drive is ensured