I face a problem sending files with the FTPClent command to my remote FTP server.
I tried a very simple program here under:
'Measurement Variables Public Bat, RefTemp, Temp, FTPResult 'TableFile variables Public OutStat As Boolean, OutStatTrig As Boolean, LastFileName As String * 20 'FTP parameter strings (as constants), Message String & Result Variable Const IPAddress="ftp.examples.fr" Const UserName="login" Const Password="pwd" DataTable (Test,True,-1) DataInterval (0,15,Sec,10) Sample (1,Bat,FP2) Sample (1,Temp,FP2) Sample (1,LastFileName,String) TableFile ("USR:Test",8,5,0,1,Min,OutStat,LastFileName) EndTable BeginProg SetStatus ("USRDriveSize",100000) Scan (1,Sec,3,0) Battery(Bat) PanelTemp (RefTemp,250) CallTable (Test) If OutStat Then OutStatTrig=True If OutStatTrig Then FTPResult=FTPClient (IPAddress,UserName,Password,LastFileName,"/Directory_path/"+Mid(LastFileName,5,20),0) OutStatTrig=False EndIf NextScan EndProg
The FTPResult variable is always set to 0.
On the remote FTP server, when checking the upcoming connection, i find:
"STOR /Directory_path/test1.dat" 550 -
The 550 means, the file path cannot be found whereas the remote directory on the server is created with the good rights. On the CR1000, the files are created on the USR part of the memory.
I have tried the active mode and the passive mode.
The CR1000 Os is the CR1000.std.32
Do you have an idea?
I'm stuck with this error, no way to find a solution, any idea will be appreciated !
Don't know if my program is ok, before looking more complex network's rights attribution in my lab.
Have you tried sending files to the FTP server using the same FTP credentials with a program like FileZilla? That might give you a clue as to what is going on. Also, in the terminal mode, W command for trace, and IP trace you can watch exactly what is happening with FTP. That info will be helpful as well.
I'm sorry, I have gived up last year this topic, and make another solution but now I'm stuck again.
Well, Gary if you see this again I will answer you :
Yeah I have tried with filezilla, actually we have more than hundred equipement that send scientific data on this server. And everthing works fine.
I treid the same program (with littles modifications) with a CR310, and I have the same log : 550.
A couple of suggestions for you:
1) Try removing the "/" at the start of the directory path as some ftp servers could interpret this as you trying to specify a directory referenced to the root directory which you probably will not have rights to.
2) Also do you really have a directory called "directory_path", because that is literally where the program is telling the server to put the file. This seems a little strange for a directory name.
And just to clarify, I believe the error you are seeing is recorded in the ftp server log file. STOR is a valid ftp command the logger is using. This means the ftp server is not liking the combination of the path and filename or you do not have rights to write to that directory.
thanks for your answer.
1) I just tried that, same for now.
2) no, "directory_path" is a fake. I mean I didn't put the real path on the forum.
Yeah STOR is for "storage", it depend of the ftp mode (passive, active, append, ...) but it's the code 550 that is important, says that the "file is missing or can't access to the path".
Can you check on the USR drive on the logger that the files for ftp'ing are being written as expected and also that lastfilename matches one of those files.
I suggest you also put the code that calls the ftpclient in a slow sequence running, say, only once per minute. This is because opening an ftp session can take a while and having the ftpclient in the main scan will cause that scan to be skipped for many scans in succession when it starts to send the file, possibly resulting in no data beeing stored the in the files you are trying to send.
I checked on the CR1000 that the files are written : it's OK, and they have data in.
I'll trying to put FTPclient in a slow sequence and will back to announce the result.
Thanks for your help !
I add a slowsequence option, but I'm not sure that is at the right place :
Public Bat, RefTemp, Temp, FTPResult Public OutStat As Boolean, OutStatTrig As Boolean, LastFileName As String * 20 Const IPAddress="ftp://url.com" Const UserName="ftpuser" Const Password="ftppass" DataTable (Test,True,-1) DataInterval (0,15,Sec,10) Sample (1,Bat,FP2) Sample (1,Temp,FP2) Sample (1,LastFileName,String) TableFile ("USR:Test",8,5,0,1,Min,OutStat,LastFileName) EndTable BeginProg SetStatus ("USRDriveSize",100000) SlowSequence Scan (1,Sec,3,0) Battery(Bat) PanelTemp (RefTemp,250) CallTable (Test) If OutStat Then OutStatTrig=True If OutStatTrig Then FTPResult=FTPClient (IPAddress,UserName,Password,LastFileName,"/path/"+Mid(LastFileName,5,12),0,0,sec,8,500) OutStatTrig=False EndIf NextScan EndProg
Have I made a mistake somewhere in the program ?
Otherwise, is there a way to use just a terminal command in the CR1000 to send, the simpliest way, a ftp file ? Just to confirm that the problem is between the cr1000 and the server ?
I'm "upping" the topic ! Still need help.
please, somebody have an idea ?