Jump to content

send to internet


 Share

Recommended Posts

hello,

how do i send some information to a ftp server

i know you can get files with "inetget"

but how do i send a file to a ftp server. so not through the e-mail

i hope you will understand my question because i am from the netherlands and my english writing is not good.

Link to comment
Share on other sites

i have download them but ftp example won't work.

and i don't understand ftp.au3

could you give a example. i mean could you fill in some thinks so that i understand how to do. and yes it is to send files.

Link to comment
Share on other sites

i have download them but ftp example won't work.

and i don't understand ftp.au3

could you give a example. i mean could you fill in some thinks so that i understand how to do. and yes it is to send files.

<{POST_SNAPBACK}>

Please provide more information on what you have tried, what isn't working, what you expected to happen and what error messages or unexpected bahavior you observed. It would also be nice to know what version of AutoIt you are running and how you are running your script.

We're all willing to help, but make it easier for us by showing us what you've already tried and be specific about what isn't working.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

hoi

i expect that the script will send a file from a computer to a ftp server.

but when i dubble click on the file i have downloaded than he gives no errors

but i think there is nothing happend

when i fill in every thing then he will give a error

see: http://home.tiscali.nl/staring/error.JPG

the code:

;===============================================================================

;

; 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, 'home.tiscali.nl', 'username', '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, 'C:\index.html', "/", $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()

i hope this will make every thing clear.

if you have any questions, you where you can find me.

Link to comment
Share on other sites

Boy, you really are starting from scratch here.

I would really recommend that you try some more basic AutoIt coding before trying to do this. Look at the helpfile, read the turorials, look through the forums and try some other sample code etc.

Specific to what you want to do here, you are not going to want to execute the FTP.au3 file directly, but rather you will want to plance it in C;\Program Files\AutoIt3\Include and INCLUDE it in your own script (#include <FTP.au3>).

You then will call the FTP functions from your script by passing in the parameters required and appropriate for your scenario.

With this understanding, look at the FTP example again.

What you want to do will not be hard with AutoIt and FTP.au3, but you need to get some experience with AutoIt before it becomes easy for you. Please spend some time on the basics and then come back here with more questions as you get the core concepts down.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

oh now i understand.

so ftp.au3 must be like you have download him and my script looks now like this:

send.au3

#include <ftp.au3>

$s_ServerName = 'myserver'
$s_Username = 'myusername'
$s_Password = 'mypassword'

$Open = _FTPOpen('my ftp')
$Conn = _FTPConnect($Open, $s_ServerName, $s_Username, $s_Password)
$Ftpp = _FtpPutFile($Conn, 'local.html', '/local.html')
$Ftpc = _FTPClose($Open)

and ftp.au3 looks like this:

ftp.au3

;===============================================================================
;
; Function Name:    _FTPOpen()
; Description:    Opens an FTP session.
; Parameter(s):  $s_Agent         - Random name. ( like "myftp" )
;                  $l_AccessType    - I dont got a clue what this does.
;                  $s_ProxyName   - ProxyName.
;                  $s_ProxyBypass   - ProxyByPasses's.
;                  $l_Flags     - Special flags.
; 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 _FTPOpen($s_Agent, $l_AccessType = 1, $s_ProxyName = '', $s_ProxyBypass = '', $l_Flags = 0)
    
    Local $ai_InternetOpen = DllCall('wininet.dll', 'long', 'InternetOpen', 'str', $s_Agent, 'long', $l_AccessType, 'str', $s_ProxyName, 'str', $s_ProxyBypass, 'long', $l_Flags)
    If @error OR $ai_InternetOpen[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
        
    Return $ai_InternetOpen[0]
    
EndFunc;==> _FTPOpen()

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

;===============================================================================
;
; Function Name:    _FTPDelFile()
; Description:    Delete an file from an FTP server.
; Parameter(s):  $l_FTPSession  - The Long from _FTPConnect()
;                  $s_RemoteFile      - The remote Location for the file.
; Requirement(s):   DllCall, wininet.dll
; Return Value(s):  On Success - 1
;                  On Failure - 0
; Author(s):        Wouter van Kesteren
;
;===============================================================================

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

;===============================================================================
;
; Function Name:    _FTPRenameFile()
; Description:    Renames an file on an FTP server.
; Parameter(s):  $l_FTPSession  - The Long from _FTPConnect()
;                  $s_Existing  - The old file name.
;                  $s_New         - The new file name.
; Requirement(s):   DllCall, wininet.dll
; Return Value(s):  On Success - 1
;                  On Failure - 0
; Author(s):        Wouter van Kesteren
;
;===============================================================================

Func _FTPRenameFile($l_FTPSession, $s_Existing, $s_New)
    
    Local $ai_FTPRenameFile = DllCall('wininet.dll', 'int', 'FtpRenameFile', 'long', $l_FTPSession, 'str', $s_Existing, 'str', $s_New)
    If @error OR $ai_FTPRenameFile[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
    
    Return $ai_FTPRenameFile[0]
    
EndFunc;==> _FTPRenameFile()

;===============================================================================
;
; Function Name:    _FTPMakeDir()
; Description:    Makes an Directory on an FTP server.
; Parameter(s):  $l_FTPSession  - The Long from _FTPConnect()
;                  $s_Remote        - The file name to be deleted.
; Requirement(s):   DllCall, wininet.dll
; Return Value(s):  On Success - 1
;                  On Failure - 0
; Author(s):        Wouter van Kesteren
;
;===============================================================================

Func _FTPMakeDir($l_FTPSession, $s_Remote)
    
    Local $ai_FTPMakeDir = DllCall('wininet.dll', 'int', 'FtpCreateDirectory', 'long', $l_FTPSession, 'str', $s_Remote)
    If @error OR $ai_FTPMakeDir[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
    
    Return $ai_FTPMakeDir[0]
    
EndFunc;==> _FTPMakeDir()

;===============================================================================
;
; Function Name:    _FTPDelDir()
; Description:    Delete's an Directory on an FTP server.
; Parameter(s):  $l_FTPSession  - The Long from _FTPConnect()
;                  $s_Remote        - The Directory to be deleted.
; Requirement(s):   DllCall, wininet.dll
; Return Value(s):  On Success - 1
;                  On Failure - 0
; Author(s):        Wouter van Kesteren
;
;===============================================================================

Func _FTPDelDir($l_FTPSession, $s_Remote)
    
    Local $ai_FTPDelDir = DllCall('wininet.dll', 'int', 'FtpRemoveDirectory', 'long', $l_FTPSession, 'str', $s_Remote)
    If @error OR $ai_FTPDelDir[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
        
    Return $ai_FTPDelDir[0]
    
EndFunc;==> _FTPDelDir()

;===============================================================================
;
; Function Name:    _FTPClose()
; Description:    Closes the _FTPOpen session.
; Parameter(s):  $l_InternetSession - The Long from _FTPOpen()
; Requirement(s):   DllCall, wininet.dll
; Return Value(s):  On Success - 1
;                  On Failure - 0
; Author(s):        Wouter van Kesteren
;
;===============================================================================

Func _FTPClose($l_InternetSession)
    
    Local $ai_InternetCloseHandle = DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'long', $l_InternetSession)
    If @error OR $ai_InternetCloseHandle[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
    
    Return $ai_InternetCloseHandle[0]
    
EndFunc;==> _FTPClose()

the only problem is:

the script send the file but he is blank. in the ftp, the file is 0 kb and on the computer he is 1 kb.

what is de problem?

Link to comment
Share on other sites

Yes, you've got the concept now.

Suggest you try doing the transfer manually with the standard FTP client to see if it works differently. Then suggest you use a full path for your source file to insure it is picking up what you think it is.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

hoi

when i transfer is whit cute ftp pro it goes well/

when i give him the path, i got the still the problem.

and you see always the autoit icon in the tray and you can't get him out. you only get him away with ctrl + alt + del

and when i let him there he will do nothing

i don't understand the problem. what is wrong?

Link to comment
Share on other sites

Perhaps you just need more specification on where the file is?

$Ftpp = _FtpPutFile($Conn, 'C:\Path\To\File\local.html', '/local.html')

Or perhaps you cannot write to the root? Maybe your CuteFTP is automatically putting you in a subfolder, like /httpdocs/ or something.

Additionally, tell us what you see when you run this code:

MsgBox(0, 'AutoIt Version', @AutoItVersion)
Link to comment
Share on other sites

you script says: 3.1.1.0

but i got some thing for you:

when i start up my ftp server on my computer and give the full rights on a map, ftp_example.au3 will upload him without a problem.

i still got the problem when i upload it to the server of my provider. so there is nothing with the script or file, it is only the rights.

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...