So here is the deal : I need to upload and download a file from my FTP.
I obviously am missing something, as I can connect to it, but not upload the file. Any idea on why "FtpPutFileW" isn't working in this case?
Cheers !
#define INTERNET_SERVICE_FTP 1
#define INTERNET_SERVICE_GOPHER 2
#define INTERNET_SERVICE_HTTP 3
#define FTP_TRANSFER_TYPE_UNKNOWN 0x00000000
#define FTP_TRANSFER_TYPE_ASCII 0x00000001
#define FTP_TRANSFER_TYPE_BINARY 0x00000002
int hIntObj, hIntObjConn;
string Password, ServerName, UserName;
bool success = false;
//Uploading the file
hIntObj=InternetOpenW("MyInternetObject",0, NULL,NULL,0);
ServerName="127.0.0.1:14147";
UserName="geek";
Password="testing";
hIntObjConn=InternetConnectW(hIntObj, ServerName, 1, UserName, Password, INTERNET_SERVICE_HTTP, 0, 0);
if (hIntObjConn>0)
{
printf("Successfully connected. %d", hIntObjConn);
string LocalFile=TerminalInfoString(TERMINAL_DATA_PATH) + "\\MQL4\\Files\\Expert.mqh.tpl";
string ServerFile="Expert.mqh.tpl";
FtpPutFileW(hIntObjConn, LocalFile, ServerFile, FTP_TRANSFER_TYPE_ASCII, 0);
}
User contributions licensed under CC BY-SA 3.0