Sign in to follow this  
Followers 0
Agent29

FTP not working..?

3 posts in this topic

#1 ·  Posted (edited)

I'm an Idiot, My problem was I didn't have the Local file in the right folder, LOL

Edited by Agent29

Share this post


Link to post
Share on other sites



Also, To set the Remote location do you just use..

$Result = _FTP_PutFile($hSession, 'test.txt', '/public_html/Folder/testfile.txt')

??

Thanks..

Yes.

Here is an example from one of my scripts

;Const $INTERNET_FLAG_PASSIVE = 0x08000000;this is important for my server, maybe for yours too.
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass,0,1,0x08000000)
.
.
$Ftpp = _FtpPutFile($Conn, $updateprog & '.exe', '/public_html/CustomerFiles/' & $Customer & '/' & $updateprog & '.exe', 0x08000000)

But there are lots of ftp udfs around so I can't say if those parameters works for your version, so here are the functions I used

;===============================================================================
;
; Function Name:    _FTPConnect()
; Description:  Connects to an FTP server.
; Parameter(s):     $l_InternetSession  - The Long from _FTPOpen()
;   $s_ServerName       - Server name/ip.
;   $s_Username         - Username.
;   $s_Password         - Password.
;   $i_ServerPort       - Server port ( 0 is default (21) )
;                   $l_Service          - I dont got a clue what this does.
;                   $l_Flags            - Special flags.
;                   $l_Context          - I dont got a clue what this does.
; Requirement(s): DllCall, wininet.dll
; Return Value(s): On Success - Returns an indentifier.
;   On Failure - 0 and sets @ERROR
; Author(s):    Wouter van Kesteren
;
;===============================================================================

Func _FTPConnect($l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_ServerPort = 0, $l_Service = 1, $l_Flags = 0, $l_Context = 0)
    
    Local $ai_InternetConnect = DllCall('wininet.dll', 'long', 'InternetConnect', 'long', $l_InternetSession, 'str', $s_ServerName, 'int', $i_ServerPort, 'str', $s_Username, 'str', $s_Password, 'long', $l_Service, 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_InternetConnect[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
    
    Return $ai_InternetConnect[0]
    
EndFunc ;==> _FTPConnect()


===============================================================================
;
; Function Name:    _FTPPutFile()
; Description:  Puts an file on an FTP server.
; Parameter(s):     $l_FTPSession   - The Long from _FTPConnect()
;   $s_LocalFile    - The local file.
;   $s_RemoteFile   - The remote Location for the file.
;   $l_Flags        - Special flags.
;   $l_Context  - I dont got a clue what this does.
; Requirement(s): DllCall, wininet.dll
; Return Value(s): On Success - 1
;   On Failure - 0
; Author(s):    Wouter van Kesteren
;
;===============================================================================

Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)

    Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'FtpPutFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_FTPPutFile[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
    
    Return $ai_FTPPutFile[0]
    
EndFunc ;==> _FTPPutFile()

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

#3 ·  Posted (edited)

I'm an idiot

Edited by Agent29

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  
Followers 0