Jump to content

FTP UDF


Yashied
 Share

Recommended Posts

LAST VERSION - 1.0

01-May-09

Deprecated.

Here is my version of FTP UDF library.

Available functions

_FTP_Startup

_FTP_Shutdown

_FTP_Open

_FTP_Close

_FTP_Connect

_FTP_Disconnect

_FTP_GetCurrentDir

_FTP_SetCurrentDir

_FTP_CreateDir

_FTP_DeleteDir

_FTP_OpenFile

_FTP_CloseFile

_FTP_DeleteFile

_FTP_RenameFile

_FTP_FileFindFirst

_FTP_FileFindNext

_FTP_FileFindClose

_FTP_ReadFile

_FTP_WriteFile

_FTP_GetFileSize

_FTP_GetFile

_FTP_PutFile

FTP UDF Library v1.0

Previous downloads: 104

FTP.au3

WinINet Error Codes (Optional)

Previous downloads: 90

WinINetErrorMessages.au3

Example1

#Include <FTP.au3>

Global Const $Host = 'ftp.mozilla.org'
Global Const $Login = ''
Global Const $Password = ''

Global $hFtp, $hSession, $hFile, $tBuffer, $nSize, $nBytes

_FTP_Startup()

$hFtp = _FTP_Open('MyFtp')
$hSession = _FTP_Connect($hFtp, $Host, $Login, $Password)

$hFile = _FTP_OpenFile($hSession, 'README')
$nSize = _FTP_GetFileSize($hFile)
$tBuffer = DllStructCreate('byte[' & $nSize & ']')
_FTP_ReadFile($hFile, $tBuffer, $nSize)
_FTP_CloseFile($hFile)

$hFile = _WinAPI_CreateFile('README', 1)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), $nSize, $nBytes)
_WinAPI_CloseHandle($hFile)

_FTP_Disconnect($hSession)
_FTP_Close($hFtp)

_FTP_Shutdown()

Example2

#Include <FTP.au3>

Global Const $Host = 'ftp.mozilla.org'
Global Const $Login = ''
Global Const $Password = ''

Global $hFtp, $hSession, $hFind, $tFind

_FTP_Startup()

$hFtp = _FTP_Open('MyFtp')
$hSession = _FTP_Connect($hFtp, $Host, $Login, $Password)

$tFind = DllStructCreate($tagWIN32_FIND_DATA)
$hFind = _FTP_FileFindFirst($hSession, '', $tFind)
While Not @error
    ConsoleWrite(DllStructGetData($tFind, 'FileName') & @CR)
    _FTP_FileFindNext($hFind, $tFind)
WEnd
_FTP_FileFindClose($hFind)

_FTP_Disconnect($hSession)
_FTP_Close($hFtp)

_FTP_Shutdown()
Edited by Yashied
Link to comment
Share on other sites

Look here:

http://www.autoitscript.com/trac/autoit/ticket/271

Completed Feature Requests (Sorted by Milestone)

FTP - make it as standard include file (or native AutoIt)

Added in version: 3.3.1.0

It would be great. But now I'm using this UDF, and decided to share them.

EDIT: I think it would be good to build in AutoIt function InetPut() (in their own threads) like InetGet().

Edited by Yashied
Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...
  • 1 month later...
  • 6 months later...

it's not working for me.

i just want to upload a file.

here is what i tried...

#Include  <FTP.au3>

const $Host = 'ftp.fadelsalehco.com'
const $Login = 'root_1'
const $Password = '*******'

local $hFtp, $hSession, $hFile, $tBuffer, $nSize, $nBytes

_FTP_Startup()

$hFtp = _FTP_Open('MyFtp')
$hSession = _FTP_Connect($hFtp, $Host, $Login, $Password)
_FTP_PutFile($hSession, "c:\web\index.php", "public_html\index.php", $lFlags = INTERNET_FLAG_TRANSFER_BINARY, $lContext = 0)

_FTP_Disconnect($hSession)
_FTP_Close($hFtp)

_FTP_Shutdown()
Link to comment
Share on other sites

  • 1 month later...

hey guys, uploading to ftp using Putftp() seems to be working fine...........but please let me know how to download files from FTP because _FTP_FileGet is not working for me,every time i get return value as 0

please help me as this is very very urgent requirement

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...