CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Apr 2006
    Posts
    3

    https upload file

    Hi everyone,

    I should start out by saying, I do not know ANY C++, I have to modifiy someone else's code, to upload a file over https to a php script on the webserver.
    This works now by using FTP. I have the code that does this below
    Code:
    int UploadFile(const char *serverName, const char* localFile, const char* remoteFile)
    {
    	int error = 0;
    	CFtpConnection *ftp = NULL;
    	BOOL ok;
    
    	try {
    		CInternetSession session(_T("Upload/1.0"));
    
    		ftp = session.GetFtpConnection(serverName, "user", "pass");
    		ok = ftp->SetCurrentDirectory(_T("data"));
    		if (ok) {
    			ok = ftp->PutFile(localFile, remoteFile, FTP_TRANSFER_TYPE_ASCII);
    		}
    
    		if (!ok) {
    			error = GetLastError();
    		}
    	}
    	catch (CInternetException* exc) {
    		error = GetLastError();
    	}
    
    	// if the connection is open, close it
    	if (ftp != NULL) {
    		ftp->Close();
    	}
    	delete ftp;
    
    	return error;
    }
    So my question, is can someone write in a drop in replacement code for this. You can hardcode the URL in the code. I am using vb.net C++.

    As I really don't know what I am doing, I am willing to pay for someone to do this, let me know and we can work out a price.

    Thank you,
    Mike
    Last edited by mlh; April 27th, 2006 at 02:37 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured