cosmos22 0 Junior Poster in Training

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;
                  }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.