How to upload a file to another server using cURL and PHP?

Upload a string to my FTP server using c++?

  • I need to know how I can take a string and upload it to my server using c++ in Microsoft Visual Studio. What I mean is the following 1) My program reads certain information from a txt file 2) Then My program puts that information in a string 3) *** I need the commands to upload that string to my FTP server I can define my FTP server detail e.g hostname,username, password Then I need my program to upload my string to that server, so later I can log into my server and read the string. Program so far #include <iostream> #include <fstream> #include <string> using namespace std; int main() { string str; ifstream file; file.open("example.txt"); file>>str; file.close(); // ************************ // Here I need the commands for uploading // ************************ return 0; } And I do not want to use an FTP client like Filezilla or anything, it has to done in Visual Studio. Thanks in Advance.

  • Answer:

    If you don't use an FTP client, you're going to have to write one. FTP is a client-server protocol. The .NET framework has classes to help, if you're using "managed" C++. See: http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest%28v=vs.90%29.aspx ...and, particularly the upload example in: http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest%28v=vs.100%29.aspx If your application isn't a .NET app, there are a number of C FTP libraries. The free ones will usually be GPL-licensed, if that matters to you. If you are unwilling or unable to GPL your application, then stick to linkable libraries with a LGPL license, and DON'T use any of the library's source code, other than to include headers. Keep this in mind as you web search for "c++ ftp client", "lgpl ftp client", etc.

Ray at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

If you don't use an FTP client, you're going to have to write one. FTP is a client-server protocol. The .NET framework has classes to help, if you're using "managed" C++. See: http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest%28v=vs.90%29.aspx ...and, particularly the upload example in: http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest%28v=vs.100%29.aspx If your application isn't a .NET app, there are a number of C FTP libraries. The free ones will usually be GPL-licensed, if that matters to you. If you are unwilling or unable to GPL your application, then stick to linkable libraries with a LGPL license, and DON'T use any of the library's source code, other than to include headers. Keep this in mind as you web search for "c++ ftp client", "lgpl ftp client", etc.

husoski

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.