Page 1 of 2

I can't write files to the specified folders via ftp

Posted: Thu Apr 14, 2022 6:14 am
by Eugene Lutsenko
I can't write files to the specified folders via ftp. And sometimes it works, and sometimes it doesn't. I tried to do it in different ways. And first make the folder current, and then write the file. And immediately record the full path. It used to work, but now it doesn't work. At the same time, what I did before works well.

Re: I can't write files to the specified folders via ftp

Posted: Thu Apr 14, 2022 6:31 am
by Tom
You always get a response from a FTP server. Look at this. It will tell you why it works sometimes and sometimes not.

Re: I can't write files to the specified folders via ftp

Posted: Thu Apr 14, 2022 10:05 am
by Eugene Lutsenko
Tom wrote: Thu Apr 14, 2022 6:31 am You always get a response from a FTP server. Look at this. It will tell you why it works sometimes and sometimes not.
I always check everything: whether it was possible to create a connection, whether it was possible to make a given folder current, whether it was possible to upload or download a file, etc. I check everything absolutely, and if something is wrong, I always give the appropriate reasonable messages. But often the server only gives out .T. or .F.. where can I get more detailed information?

Re: I can't write files to the specified folders via ftp

Posted: Thu Apr 14, 2022 10:13 pm
by Wolfgang Ciriack
Have you set oFTP:PassiveMode := .T. ?

Re: I can't write files to the specified folders via ftp

Posted: Fri Apr 15, 2022 10:40 am
by Eugene Lutsenko
Wolfgang Ciriack wrote: Thu Apr 14, 2022 10:13 pm Have you set oFTP:PassiveMode := .T. ?
No, he didn't. And where and how to do it?

Re: I can't write files to the specified folders via ftp

Posted: Fri Apr 15, 2022 11:41 pm
by Wolfgang Ciriack
I use the ftp client from Xb2.Net. If you use the XBase++ ftp client look at the FtpClient:connect() description:
:connect(FTP_CONNECT_PASSIVE_MODE)

Re: I can't write files to the specified folders via ftp

Posted: Sat Apr 16, 2022 4:35 am
by Eugene Lutsenko
hi, Wolfgang Ciriack!
I use the xBase++ ftp client. Thanks, I'll try it now.
:

Re: I can't write files to the specified folders via ftp

Posted: Sat Apr 16, 2022 1:22 pm
by Wolfgang Ciriack
you must include "asinet.ch".

Re: I can't write files to the specified folders via ftp

Posted: Sat Apr 16, 2022 8:40 pm
by Eugene Lutsenko
hi, Wolfgang!
Here is a fragment of the program. It works, but incorrectly. Function: oFtp:Directory() does not see the folder: "htdocs". The function: oFtp:CurDir("\htdocs\messages") cannot make the current folder: "\htdocs\messages" and returns a space.

Code: Select all

oFtp := FTPClient():new( cFtpServer, cUserName, cPassword ) // Соединение с моим сайтом и авторизация
 
 IF .NOT. oFtp:connect(FTP_CONNECT_PASSIVE_MODE)             // Есть соединение с моим сайтом и авторизация?
    DC_Impl(oScrn)
    LB_Warning('Нет соединения с FTP-сервером', '(С°) "Crypton"')
    cOutString = 'Нет соединения с FTP-сервером'
 ELSE

    wtf oFtp:curDir()
    wtf oFtp:Directory()                          // VALUE: {{"Downloads.exe", 10242016, 20201202, "07:57:00", "N", 0,         , "00:00:00",         , "00:00:00"}}
    wtf oFtp:curDir("\htdocs\messages")
    wtf oFtp:Directory()                          // VALUE: {{"Downloads.exe", 10242016, 20201202, "07:57:00", "N", 0,         , "00:00:00",         , "00:00:00"}}

Re: I can't write files to the specified folders via ftp

Posted: Sat Apr 16, 2022 9:08 pm
by Wolfgang Ciriack
Try oFtp:curDir("htdocs") (without the backslash at the beginning).
Then aF := oFtp:Directory(). What is the content of aF ?