I’ve tried using let fileEntry = require(‘uxp’).storage.localFileSystem.getFileForOpening(), but get the Error: Plugin is not permitted to access the file picker.
I also tried using the method you suggested from this post Saving a JPG to a selected folder - #3 by 4t0m1c
I found I had to use executeAsModal but still can’t get it to save to a temporary folder.
const lfs = uxp.storage.localFileSystem;
const tempFolder = await lfs.getTemporaryFolder();
const saveFileToFolder = async (tempFolder, fileName="temp") => {
const file = await tempFolder.createFile(`${fileName}.jpg`);
const activeDocument = require("photoshop").app.activeDocument;
return activeDocument.save(file);
}
await require('photoshop').core.executeAsModal(saveFileToFolder);
It errors saying the createFile is not a function.
I just need a way to attach the active document’s file object to the fetch or xhr upload.