Upload file from PS

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

biozork

Upload file from PS

Post by biozork »

First, hello to all of you

I have used these forums for a couple of weeks, searching for answers and examples, and I love it.. Found everything I need so far. There is really some skilled people here! I hope I will be able to contribute to these forums in the near future.

I am making a "web-designers panel", that help the workflow of a web-designer.
The designer is able to mark areas of a design to be cut-out and saved locally as files. This part, I have made already.

The last step that I'm missing is the upload of the file directly from Photoshop to my server.

I have searched the internet for many days and not found a good solution so far. I have seen examples of uploading with ftp, but in the setup I'm aiming for ftp will not be available. However the server I work with, is accepting normal http-post-uploads. I have little to no experience with actionscript/flex/flash, so I prefer to do it with JavaScript. However, if that is the only solution, I would love some guide to help me get startet with uploading from flex.

Perhaps a solution that makes use of Bridge httpConnection, or directly from Photoshop with a socket post. (important that the script can be executed from within Photoshop)

I have found these 2 examples on the forum:

bb/viewtopic.php?f=9&t=4452&p=20178
bb/viewtopic.php?f=13&t=2191&p=9430

With no luck of getting either to work.

I have also tried with The Extendables library, but the available documentation limited on the http post part.
http://extendables.org/

I have managed to succesfully create a socket GET, with some simple string data - server returns json data. Feel free to try it out:
Code: Select all      var socket = new Socket(),
         port = 80,
         domain = "l-e-c.dk",
         page = "/json.asp",
         data = 4,
         answer;

      if(socket.open(domain + ":" + port,"binary")) {
         socket.write("GET http://" + domain + page + "?data=" + data + " HTTP/1.0\n\n");
         answer = socket.read();
         alert(answer);
         socket.close();
      }

But sending files with a socket POST is much harder than first anticipated.

If someone could post a working example, or lead me in the right direction, it will be highly appreciated.
I will make a simple library for uploading / downloading files to share with this forum when I get this to work.

Thanks in advance
// biozork