Page 1 of 1
FTP Question
Posted: Sat May 11, 2019 2:11 pm
by serge_girard
Hello,
I need to upload some files
Code: Select all
oFtp:uploadFile(LOCALFILE, REMOTEFILE)
to my server and want to add 'file properties/permissions' (value 0600). In PHP this is done with the command
Code: Select all
$cfile = 'somefile.txt');
chmod($cfile, 0600);
Does anybody knows how to do this HMG?
Thx,
Serge
Re: FTP Question
Posted: Sat May 11, 2019 2:31 pm
by andyglezl
Re: FTP Question
Posted: Sat May 11, 2019 2:38 pm
by serge_girard
Thanks Andrés, but this not what I mean (or want). I need a CLIPPER/HARBOUR/HMG command/function like this:
See my example:
Code: Select all
oUrl := tUrl():New()
oUrl:cProto := 'ftp'
oUrl:cServer := x_FTP_SERVER
oUrl:cPath := ''
oUrl:cFile := ''
oUrl:cUserid := X_FTP_USER
oUrl:cPassword := X_FTP_PASSW
oFtp := tIPClientFtp():New( oUrl )
CC := 0
DO WHILE .T.
IF oFtp:open()
EXIT
ELSE
CC++
IF CC >= 4
? "NO FTP connection ", oFtp:lastErrorMessage()
RETURN .F.
ELSE
IF 'TIMEOUT' == ALLTRIM(UPPER(oFtp:lastErrorMessage()))
? "FTP TIMEOUT ", oFtp:lastErrorMessage()
ENDIF
ENDIF
ENDIF
ENDDO
IF .NOT. oFtp:open()
? oFtp:lastErrorMessage()
RETURN
ENDIF
LclFileM := "myfile.txt"
RmtFileM := '/my_domain/files/myfile.txt'
? 'RmtFileM', RmtFileM
? 'LclFileM', LclFileM
IF FILE(LclFileM)
IF .NOT. oFtp:uploadFile(LclFileM, RmtFileM) // here I need to chmod(RmtFileM, 0600);
MSGINFO('Unable to upload' )
ENDIF
ENDIF
Serge
Re: FTP Question
Posted: Sat May 11, 2019 3:23 pm
by mol
Try to upload php file and execute it
Re: FTP Question
Posted: Sat May 11, 2019 3:39 pm
by andyglezl
mmm... no puedo probarlo, pero tal vez sería así ?
*--------------------------------------------------------------------
mmm ... I can not prove it, but maybe it would be like that ?
cMsgShell:=SHELLEXECUTE( 0, "open" , "ICACLS.exe", "RmtFileM /grant:r User:PermissionM" )
Re: FTP Question
Posted: Sat May 11, 2019 4:33 pm
by serge_girard
Uploading always results in -rw-r-r- (644) , User:read+write. Group:read. World:read.
I made a small PHP program that is called after my upload, which set the file permissions.
This, of course, works fine but requires a second step in the process.
Andrés, ICALCLS.EXE is for Windows and my server is Linux based!
Serge