Issues with FTP image sending

 

Hi there,

I've created a script to automatically take a screenshot and save it locally on my Meta trader.


So far all good


i've then made another script to send the screenshot from the local metatrader folder to a remote server.

When trying to execute it gives me error 5002 (wrong file name).


Below you can find my script:


//+------------------------------------------------------------------+

//|                                                 Transfer FTP.mq4 |

//|                                       Copyright 2019, UCapital24 |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2019, UCapital24"

#property link      "https://www.mql5.com"

#property version   "1.00"

#property strict



#import "shell32.dll"



#import

string Filename = TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL4\\Files\\shots\photo.jpg";





//+------------------------------------------------------------------+

//| Script program start function                                    |

//+------------------------------------------------------------------+

void OnStart()

  {

//---

 

 if (!SendFTP(Filename));

Alert(GetLastError());

 

 

 //  SendFTP(Filename,NULL);

  }

//+------------------------------------------------------------------+



The FTP area in my metatrader is all correctly set.


Can anyone please explain me what the issue is?

Discover new MetaTrader 5 opportunities with MQL5 community and services
Discover new MetaTrader 5 opportunities with MQL5 community and services
  • www.mql5.com
Ask questions on technical analysis, discuss trading systems and improve your MQL5 programming skills to develop your own trading strategies. Communicate and share your experience with traders from anywhere in the world, answer questions and help beginners — MQL5.community is developing along with you. Become an Author at MQL5.com! Thenew...
 
string Filename = "shots\\photo.jpg";
 
Alain Verleyen:

It doesn't work.The error is now 4264 (FTP path not found on server).It print this message:  2019.12.05 14:41:21.573 FTP: change directory failed [C:\Users\trading\AppData\Roaming\MetaQuotes\Terminal\B8A68C5F345865DD17F6020D17018025//MQL4//Files//shots//] - 550 C:\Users\trading\AppData\Roaming\MetaQuotes\Terminal\B8A68C5F345865DD17F6020D17018025//MQL4//Files//shots//: No such file or directory


Documentation on MQL5: Network Functions / SendFTP
Documentation on MQL5: Network Functions / SendFTP
  • www.mql5.com
Network Functions / SendFTP - Reference on algorithmic/automated trading language for MetaTrader 5
 
GreenKobra:

It doesn't work.The error is now 4264 (FTP path not found on server).Wht I have to write in the second parameter of SendFTP function?

Of course it works.

Read the documentation.

 
Alain Verleyen:

Of course it works.

Read the documentation.

thank you very much, now it works

 
Alain Verleyen:

Of course it works.

Read the documentation.

Juast a question...SendFTP function doesn't work on custom indicators?

 
GreenKobra:

Juast a question...SendFTP function doesn't work on custom indicators?

Try it and let us know.