This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
So I'm using the apache commons classes and have created the following ftp method;
I ran the piece of code on a windows machine and no problems. I then ran the code on my mac and for some reason it doesn't work, to specify; the client logs in, it creates the testDir, but it doesn't upload any files. To make things worse theres little indication as to why it doesn't work. There is no stack trace, no error message, I've checked the permissions of the directory and its contents and they all seem to be readable and writable by all. I even created a FileOutputStream to write the contents of the FileInputStream on to the desktop so that I can verify that its actually working. And the files are written correctly, without any corruption. The only thing that indicates anything is wrong is the return code of the method getReplyCode(). After every attempt to upload I get the 500 response, so I looked this up and it means "Syntax error, command unrecognized. This may include errors such as command line too long". That's not very helpful unfortunately.
I'm at a loss here, because the same piece of code works fine on a windows machine. Is there anything that I could be missing?
Joined: Feb 19, 2008
Okay so I figured out what the problem was. Basically I needed to set the following on my instance of ftp client;
because I'm uploading images not text files. And the following;
I'm not 100% but i believe its because I'm behind a firewall. Also I found adding this piece of code really helps the debugging process;
It basically outputs to the console everything that the server replies with.