Jump to content
Sign in to follow this  

ftp upload

Recommended Posts

a year ago i made this autoit script that could upload a file to a folder on my ftp server.

Now i need to change it a bit, and it just wont work.. im really confused :/

its not a very long script

(im using this ftp udf FTP )

heres the code:

#include <GuiConstants.au3>
#include <array.au3>
#include <file.au3>
#include "ftp.au3"

$mainwindow = GuiCreate("billed ændring", 400, 200)

$oobutton = GUICtrlCreateButton ( "Choose file", 20, 5, 180, 60, 0x0300)

$gembutton = GUICtrlCreateButton ( "Upload", 200, 5, 180, 60, 0x0300)

GuiCtrlCreateLabel("Filnavn:", 10, 80)

$label = GuiCtrlCreateLabel("Ingen fil valgt", 55, 80, 345, 40)


While 1

   $msg = GUIGetMsg()


      Case $msg = $GUI_EVENT_CLOSE
       ;Exit the script

      Case $msg = $oobutton
                $navn = FileOpenDialog ("Vælg fil:", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "(*.jpg)")
                If @error Then ContinueLoop
                GUICtrlSetData($label, $navn)

    $username = '***'
    $pass = '***'
    $server = '***'
    Global $INTERNET_FLAG_PASSIVE = 0x08000000
    Global $FTP_TRANSFER_TYPE_UNKNOWN = 0x00000000
    Global $FTP_TRANSFER_TYPE_ASCII = 0x00000001
    Global $FTP_TRANSFER_TYPE_BINARY = 0x00000002

     Case $msg = $gembutton
            Dim $szDrive, $szDir, $szFName, $szExt
            $TestPath = _PathSplit($navn, $szDrive, $szDir, $szFName, $szExt)
            GUICtrlSetData($label, $szFName& $szExt & " - bliver nu uploadet")
            $Open = _FTPOpen('FTPm')
            $Conn = _FTPConnect($Open, $server, $username, $pass, 21, 1, $INTERNET_FLAG_PASSIVE)
            $Ftpp = _FtpPutFile($Conn, $navn, 'FF/'& $szFName& $szExt, $FTP_TRANSFER_TYPE_BINARY)
            $Ftpc = _FTPClose($Open)
            MsgBox(0,"Filen er uploadet","Filen blev uploadet.. Du kan nu finde den på hjemmesiden!")
            GUICtrlSetData($label, $szFName& $szExt & " - kan nu findes på hjemmesiden")


when i use the script nothing happends :/

Edited by mads3n

Share this post

Link to post
Share on other sites

You need to use DllOpen() for WinInet.dll now.... just search and there should be many hits ....

Edited by JdeB

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  

  • Create New...