Well, what I want to do is, send a file (most likely jpg or gif) to another machine on the network and save it in a particular directory of that machine, with the file renamed to something else. For example, I have an image named mypic.jpg. My application will send this file to another machine and it will be saved there as /DBUser/images/user0001.jpg. So, what would be the neat and clean way to do this?
If I were to do this app using web technology, I would send the file using HTTP 'post' method and let the webserver and PHP do the rest on the remote / server machine. I have some experience of making simple client server applications with Java which simply talk to each other. But never worked with protocols. Will FTP be of any help?
FTP would be well suited because its whole purpose in life is transferring files. I'd probably try for that unless there is some reason an FTP server is not allowed on your network.
HTTP protocols would be some work to build multi-part requests. The Apache HTTP Client package would probably make that simpler. I haven't tried it first hand. It would also be some work to accept the uploaded file to the web server, again because of multi-part request structures. You can find open source or free solutions.
Raw sockets might be easier than HTTP. You have to hand build more of the parts, but you can make up your own very simple protocol.
Any of that sound useful?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Mousa A. Rafi
Joined: Jan 30, 2005
Stan James, Thanks for your suggestions. They indeed sound useful to me. Well, as you mentioned, FTP is the most suitable solution and as long as it full-fills the constraints I mentioned earlier I'd really want to go for it. But, as you can guess, I wouldn't have started this topic if I knew how to do it in the first place.
What I would really wish for is a short program / example that works with FTP to get myself running and then go for the doc for details and advanced features.
Thanks once again for the help. By the way, I liked that quotation you used for signature.