Shoutbox

[Help] FTP upload - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Help] FTP upload (/showthread.php?tid=62877)

[Help] FTP upload by rob_botch on 07-09-2006 at 08:50 AM

I have written a script that uploads a file to an ftp server. This works perfectly when the server information (address, directory, username, password, port) are hardcoded. However, when I added the settings window to allow users to alter the information, the upload stopped working. Hardcoding then again works. Using Debug.Trace() to check the variables just before uploading reveals that they are, in fact, correct.

Is there anything that I have overlooked?

Thank you,
Robert


RE: [Help] FTP upload by matty on 07-09-2006 at 04:32 PM

Here is code I use for Screenshot Sender 4

code:
    function OnWndFTPUploadEvent_CtrlClicked(Wnd, sControlId){
        if(sControlId == 'BtnTest'){
            var tmpWnd = MsgPlus.CreateChildWnd(Wnd, "ss4_gui.xml", "WndFTPUploadTest", 67, 174, true);
            Wnd.SendControlMessage('BtnTest', WM_ENABLE, 0,0);
            var hConnection;
            var hOpen;
            var pFlag;
           
            if (PassiveConnection == true){    pFlag = 134217728; }
            else{ pFlag = 0; }
           
            hOpen = Interop.Call('wininet.dll', 'InternetOpenW', 'SS4 FTP Upload', 0, '', '', 0)
            hConnection = Interop.Call('wininet.dll', 'InternetConnectW', hOpen,
                                                                          Wnd.GetControlText('txtServer'),
                                                                          eval(Wnd.GetControlText('txtPort')),
                                                                          Wnd.GetControlText('txtLogin'),
                                                                          Wnd.GetControlText('txtPassword'),
                                                                          1,
                                                                          pFlag,
                                                                          0);
           
            var pParent = Interop.Call('user32', 'GetAncestor', tmpWnd.Handle, 2)
           
            Interop.Call('user32', 'ShowWindow', pParent, 0);
           
            if (hConnection > 0){
                Interop.Call('user32', 'MessageBoxW', 0, 'Connection to server successful', 'Successful', 64);
            }
            else{
                Interop.Call('user32', 'MessageBoxW', 0, 'Connection to server unsuccessful', 'Unsuccessful', 64);
            }
            Interop.Call('user32', 'ShowWindow', pParent, 1);
            Interop.Call('wininet.dll', 'InternetCloseHandle', hConnection);
            Interop.Call('wininet.dll', 'InternetCloseHandle', hOpen);
           
            tmpWnd.Close(1);
            Wnd.SendControlMessage('BtnTest', WM_ENABLE, 1,0);
        }
    }