Skip to main content
Participant
February 3, 2021
Question

Send a file open in PS to an API

  • February 3, 2021
  • 0 replies
  • 166 views

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 !

 

 

This topic has been closed for replies.