954,167 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Uploading to a FTP server? My code is wrong...

Hi.

I'm designing something that uploads files to an FTP server of the users choice, so they quickly upload things and access them as a way of backing up files, almost.

I would like to upload the file on the C: called pic.jpg as a test, but I've been having some problems...


I haven't filled it out yet, but I'm using the FTP provider tripod:

ftp.tripod.com

Thanks, everyone...

int upload(char *server, char *user, char *pass, char *localF, char *remoteF)
   {    
       HINTERNET hInternet;
       HINTERNET hFtpSession;
       hInternet = InternetOpen(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0);
      hFtpSession = InternetConnect(hInternet,server,INTERNET_DEFAULT_FTP_PORT, user,pass,INTERNET_SERVICE_FTP, 0,0 );
       if(FtpPutFile(hFtpSession, localF, remoteF, FTP_TRANSFER_TYPE_BINARY, 0))
           {
           return 0;
           } else {
           return -1;
           }
                      
       InternetCloseHandle(hFtpSession);
       InternetCloseHandle(hInternet);

   }
int main()
{
if(upload("ftp server", "user", "pass", "C:\\pic.jpg", "mypic.jpg")) {
    printf("File %s uploaded\n", localF);
      } else {
                  printf("File %s failed\n", localF);
    FileSubmit();
    return 0;
                  }
}
cosmos22
Junior Poster in Training
80 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You