Question
Send a file open in PS to an API
Hi,
I need to take the current active document open in photoshop and send it to a JS function who need the file in parameter.
I tried by getting the path of the file like this :
csInterface.evalScript('app.documents[0].fullName.parent.fsName.toString()',function(result){
csInterface.evalScript('app.documents[0].name', function(res) {
var response = result+"/"+res;
var path = response.replace(/\\/g, '/');
console.log(path);
var file = window.cep.fs.readFile(path);
console.log(file);
//projectCreateDownloadToken(file.data);
});
and then use window.cep.fs.readFile to get the file from the path but it only take the data and not the file.
Maybe I need to use
var arg = 'file=@'+path;
var url ="your_server_url ";
console.log(window.cep.process.createProcess('/usr/bin/curl','--form',arg,url));
But I'm looking for an other solution. Thank you for any helps !
