FTP Question

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

FTP Question

Post 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
There's nothing you can do that can't be done...
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: FTP Question

Post by andyglezl »

Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: FTP Question

Post 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
There's nothing you can do that can't be done...
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: FTP Question

Post by mol »

Try to upload php file and execute it
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: FTP Question

Post 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" )
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: FTP Question

Post 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
There's nothing you can do that can't be done...
Post Reply