Jump to content
Sign in to follow this  
longtex

Any ftp...() help?

Recommended Posts

longtex

I've got a little autoit app that ftp's a given file (actually comes from a scanner, whose driver executes my app automagically) to a linux web server (running for this purpose a Joomla-operated website).

When the file is uploaded, its permission attributes are at "0600". I need to change this. chmod works fine... manually; I know the capability is there, because my GUI FTP client (Total Commander) has no problem changing the permissions... but I need to be able to do it from inside the autoit app so it's absolutely seamless, no manual steps involved (other than typing in a name for the file and selecting the destination from a drop down list).

Okay... so in the app, we're logged in with the exact same user as in the GUI FTP client, putting a couple of files to the exact same directory. Now, the files are sent, and... chmod($filename,"0644")...

Is there anything in the _ftp() libs that can chmod, or how else can autoit handle it?

Thanks - Tex

Edited by longtex

Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too?

Share this post


Link to post
Share on other sites
martin

I've got a little autoit app that ftp's a given file (actually comes from a scanner, whose driver executes my app automagically) to a linux web server (running for this purpose a Joomla-operated website).

When the file is uploaded, its permission attributes are at "0600". I need to change this. chmod works fine... manually; I know the capability is there, because my GUI FTP client (Total Commander) has no problem changing the permissions... but I need to be able to do it from inside the autoit app so it's absolutely seamless, no manual steps involved (other than typing in a name for the file and selecting the destination from a drop down list).

Okay... so in the app, we're logged in with the exact same user as in the GUI FTP client, putting a couple of files to the exact same directory. Now, the files are sent, and... chmod($filename,"0644")...

Is there anything in the _ftp() libs that can chmod, or how else can autoit handle it?

Thanks - Tex

This might help, but it's been a while since I used it and even then not for chmod. Searching might find something better.

;===============================================================================
;
; Function Name:    _FTPCommand()
;modified by mg to set @error to getlasterror if ftpcommand fails.
; Description:      Sends a command to an FTP server.
; Parameter(s):     $l_FTPSession    - The Long from _FTPOpen()
;            $s_FTPCommand     - Commad string to send to FTP Server
;            $l_ExpectResponse   - Data socket for response in Async mode
;            $s_Context         -  A pointer to a variable that contains an application-defined
;                      value used to identify the application context in callback operations
;            $s_Handle - A pointer to a handle that is created if a valid data socket is opened.
;                The $s_ExpectResponse parameter must be set to TRUE for phFtpCommand to be filled.
;
; Requirement(s):   DllCall, wininet.dll
; Return Value(s):  On Success - Returns true.
;                   On Failure - 0  and sets @ERROR
; to read the response from the server use  InternetGetLastResponseInfo.
; Author(s):        Bill Mezian
;
;    Command Examples: depends on server syntax. The following is for
;    Binary transfer, ASCII transfer, Passive transfer mode (used with firewalls)
;    'type I' 'type A'  'pasv'
;
;===============================================================================

Func _FTPCommand($HD,$l_FTPSession, $s_FTPCommand, $l_Flags = 0x00000001, $l_ExpectResponse = 0, $l_Context = 0, $s_Handle = '')
       if $HD = 0 Then  $HD = 'wininet.dll'
           
       $le = 0
        $es = ''
    Local $ai_FTPCommand = DllCall($HD, 'int', 'FtpCommand', 'long', $l_FTPSession, 'long', $l_ExpectResponse, 'long', $l_Flags, 'str', $s_FTPCommand, 'long', $l_Context, 'str', $s_Handle)
    ;_InternetGetLastResponseInfo($le,$es)
    If @error OR $ai_FTPCommand[0] = 0 Then
        $x = DLLCall("kernel32.dll","long","GetLastError")
       ; msgbox(0,'ftpcommand last error was',$x[0])
        if $x[0] = 12003 Then
        $le = 0
        $es = ''
        _InternetGetLastResponseInfo($HD,$le,$es)
        ;msgbox(0,$le,$es)
        
        EndIf
        
       ;MsgBox(0,"",$x[0])
        SetError(-$x[0])
        Return 0
    EndIf
    ;Return $s_return
    Return $ai_FTPCommand[0]

EndFunc;==> _FTPCommand()

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
longtex

This might help, but it's been a while since I used it and even then not for chmod. Searching might find something better.

Sounds plausible. I'll give that a shot asap.

I'm a believer in searching... but it's dependent on finding the right keywords (and more, o'course)... I'm not sure I saw ftp_command() in any results so far, at least not regarding ftp, and I didn't make the connection for whatever reason.

Thanks - Tex


Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too?

Share this post


Link to post
Share on other sites
longtex

Sounds plausible. I'll give that a shot asap.

I'm a believer in searching... but it's dependent on finding the right keywords (and more, o'course)... I'm not sure I saw ftp_command() in any results so far, at least not regarding ftp, and I didn't make the connection for whatever reason.

Thanks - Tex

Nope. I had a heck of a time finding it, and I may not have found the right one - I used ftp_ex lib and it appears to work fine (the outting/sending, etc), but it fails to chmod the file (or chown, which would accomplish what I want, also). The Win ftp command set does not include chown or chmod (according to its help), which may explain the failure.

However... the various GUI FTP clients that I've looked at all seem to support at least chmod with no problems at all, so I'm assuming there is somewhere an autoit-accessible function to do this.

I'm going to go ahead and open a new thread, since this one specifically mentions ftp in the title, and it looks like the solution lies elsewhere. I'll edit this to point to the new thread once it's posted.


Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.