I'll consider that as well, but all I need to do realy is upload the file
then check to confirm it got there.
To do that, you need to connect your Socket first, wait for a response from
the server, verify the response, send a PASV command to the server, open
your data connection, write the file to the server, close your data
connection, and then wait for a response from the server on your Command
connection.
Any of these can fail over a network, even though they rarely do. That's
what I was talking about. It can be a real nightmare trying to figure out
what went wrong if you don't account for every possibility.
As for your problems with the file upload, be sure that you specify the
absolute file path to your data connection for fetching the file, and a
root-relative path on the server for where you want to upload the file to.
In FTP, the root folder is the "lowest" folder you can access with your
account. This is referred to as "/" in FTP server paths. If you want to
upload the file to a folder underneath that folder, you would add the folder
name after the slash. For example, if the remote folder is:
C:\Inetpub\FtpRoot\folder1
It will be the folder "/" to your client. If you want to upload to
C:\Inetpub\FtpRoot\folder1\subfolder1
Your upload path will be
"/subfolder1/filename.xxx"
So, your command would be: "STOR /subfolder1/filename.xxx" + CRLF
Always be sure to check the response code, the first 3 characters in the
response. It will indicate whether or not the action succeeded. Your app may
not throw any exceptions, but fail to upload the file anyway.
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.