Sign in to follow this  
Followers 0
Yashied

FTP UDF

13 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Nice !

find your version more simple to use :D

Can you post some code for most common operation ?

(_FTP_GetFile, _FTP_putFile, etc)

good job,

m.

Edited by myspacee

Share this post


Link to post
Share on other sites

Good jobs.

Thanks.

Share this post


Link to post
Share on other sites

where i have to put the location of my zip file which i want to upload?


Share this post


Link to post
Share on other sites

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()

Share this post


Link to post
Share on other sites

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

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