Jump to content

_FTP_ProgressUpload crashes the GUI


nf67
 Share

Recommended Posts

Hi there,

I've written this script to demonstrate the problem, it generates a GUI of which the progressbar should update once the upload is started. Instead, the GUI crashes once u is pressed and the upload is started.

EDIT: Updated with FTP details!

#include <FTPEx.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>

$GUI=GUICreate("Press U",250,20)
$ProgressBar = GUICtrlCreateProgress(0,0,250,20)
$Progress = ""

GUISetState(@SW_SHOW)

HotKeySet("u","Upload")
$FilePath = "C:\10mb.bin" ;Download a 10MB dummy file at http://au3.comyr.com/10MB.bin

While 1
    $Msg = GUIGetMsg()
    If $Msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
WEnd

Func Upload()
    WinSetTitle("Press U","","Upload @ 0%")
    $Open = _FTP_Open("Progress FTP")
    $Connect = _FTP_Connect($Open,"ftp.au3.comyr.com","a7800447","autoit3")
    If $Connect = 0 Then
        MsgBox(0,"Error","Couldn't connect")
    Else
        $Upload = _FTP_ProgressUpload($Connect, $FilePath, "/public_html/Uploaded-10MB.bin", "Update")
    EndIf
EndFunc

Func Update($Percentage)
    GUICtrlSetData($ProgressBar, $Percentage)
    WinSetTitle("Upload @ ","","Upload @ " & $Percentage & "%")
    If $Percentage = 100 Then
        GUIDelete($GUI)
        MsgBox(0,"Done!","Upload completed.")
        Exit
    Else
        Return 1
    EndIf
EndFunc

What's wrong :-/ ?

Thanks in advance!

Edited by nf67
Link to comment
Share on other sites

As it turns out, there's nothing wrong with the script. It works fine when the ftp.au3.comyr.com server is used. Apparently it just doesn't play nice with my own server, it only generates a 0 byte file (named correctly though) and crashes, any suggestions?

Edited by nf67
Link to comment
Share on other sites

When I write a program using FTP I usually add an alternative method using FTP.exe (standard in wondows)

I try to use autoit's FTP functions, but if I come across an error I write a batch file that I run through FTP.exe.

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