Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.5k views
in .NET FTP by (400 points)
hi,

in the documentation they say:


FTPConnection.UploadFile Method (localPath, remoteFile)

Parameters
localPath : Path of the local file.

remoteFile : Name of remote file in current working directory.


so in the remoteFile parameter, should i only put the name of the file to be uploaded or should i choose the folder path (on the server) to which i want to upload the text file ?

5 Answers

0 votes
by (162k points)
Best to change directory to the folder path you want on the server and then upload.

It may work giving the remote path, but some servers don't support that.
0 votes
by (400 points)
just to see if i got u well

below is my code, im trying to upload a text file (me.txt) to the server. This file is located on my c drive and i want to upload it to the server (i don't care to which drive on the server it should be uploaded to) let's say i will upload it on C:\

ftpConnection1.UploadFile(@"C:\me.txt", @"C:\meUploaded.txt");

are the parameters here correct?
0 votes
by (400 points)
anyway the posted code is giving me an error

ftpConnection1.UploadFile(@"C:\me.txt", @"C:\meUploaded.txt");

when the remote file parameter is : @"C:\meUploaded.txt" i get an error

so is it correct to let the Remotefile be: "meUploaded.txt" ?
0 votes
by (51.6k points)
FTP servers use UNIX-style file paths. Furthermore, the directory-structure that you see when logged into your FTP server is not the same as that of the machine that the server is running on. For example, IIS's FTP server has an 'FTP root' directory (usually C:\Inetpub\ftproot) and all directories and files accessed through the FTP server are given relative to that directory. So for example, if you have a file whose Windows path is C:\Inetpub\ftproot\mydir\myfile.txt, then the path as seen from an FTP client would be /mydir/myfile.txt. The way that these directory structures are set up vary from one FTP server to the next.

So I don't know what server you're on, but @"C:\meUploaded.txt" definitely won't work. Try using @"/meUploaded.txt" or even just @"meUploaded.txt".

- Hans (EnterpriseDT)
0 votes
by (400 points)
thanks :) it worked

Categories

...