Hello There, Guest! (LoginRegister)

Skinning Documentation

Introduction to Scripting
Getting Started
What's a Messenger Plus! Script?
Scripting Environment
Your First Script
Working with Scripts
From Plugins to Scripts
Packaging your Script
Windows for your Script
Testing your Windows
Objects Reference
Debug Object
Description
Functions
Trace
ClearDebuggingWindow
Properties
DebuggingWindowVisible
Messenger Object
Description
Functions
AutoSignin
Signout
OpenChat
Properties
Version
VersionBuild
ContactListWndHandle
CurrentChats
ReceiveFileDir
MyContacts
MyEmail
MyUserId
MyStatus
MyName
MyPersonalMessage
MyCurrentMedia
MyDisplayPicture
CustomEmoticons
MsgPlus Object
Description
Functions
DisplayToast
DisplayToastContact
CreateWnd
CreateChildWnd
AddTimer
CancelTimer
PlaySound
LockMessenger
LogEvent
RemoveFormatCodes
DownloadFile
UploadFileFTP
LoadScriptFile
ExtractFromZIP
Properties
Version
VersionBuild
ScriptRegPath
ScriptFilesPath
MessengerIsLocked
UILangCode
ChatWnds Object
Description
Functions
Iterator
Properties
Count
ChatWnd Object
Description
Functions
SendMessage
SendFile
AddContact
DisplayInfoMessage
ResetInfoMessage
EditText_GetCurSelStart
EditText_GetCurSelEnd
EditText_SetCurSel
EditText_ReplaceSel
HistoryText_GetCurSelStart
HistoryText_GetCurSelEnd
HistoryText_GetTextRange
Properties
Handle
Contacts
EditText
EditChangeAllowed
ChatLogEnabled
OverrideFmtEnabled
IsMobileChat
Contacts Object
Description
Functions
Iterator
GetContact
Properties
Count
Contact Object
Description
Properties
Email
Network
Status
Name
PersonalMessage
CurrentMedia
Blocked
DisplayPicture
IsFloating
Emoticons Object
Description
Functions
Iterator
GetEmoticon
Properties
Count
Emoticon Object
Description
Properties
Shortcut
Name
PictureFile
PlusWnd Object
Description
Functions
Close
RegisterMessageNotification
GetControlHandle
SendControlMessage
GetControlText
SetControlText
GetElementPos
Button and Checkmark Controls
Button_IsChecked
Button_SetCheckState
Button_SetElementText
ComboBox Controls
Combo_AddItem
Combo_RemoveItem
Combo_GetCurSel
Combo_SetCurSel
Combo_GetItemData
Combo_GetCount
ListBox Controls
LstBox_AddItem
LstBox_GetItemText
LstBox_RemoveItem
LstBox_GetCurSel
LstBox_SetCurSel
LstBox_GetItemData
LstBox_GetCount
ListView Controls
LstView_AddItem
LstView_SetItemText
LstView_GetItemText
LstView_RemoveItem
LstView_GetItemData
LstView_GetCount
LstView_GetSelectedState
LstView_SetSelectedState
LstView_GetCheckedState
LstView_SetCheckedState
LstView_SetItemIcon
Edit and RichEdit Controls
EditBox_SetCurSel
EditBox_ReplaceSel
EditBox_GetCurSelStart
EditBox_GetCurSelEnd
RichEdit_GetTextRange
RichEdit_SetCharFormat
Browser Controls
Browser_GetInterface
Image Elements
ImageElmt_SetImageFile
Properties
Handle
Visible
WindowId
Interop Object
Description
Functions
Call
Call2
FreeDll
GetLastError
Allocate
GetCallbackPtr
DataBloc Object
Description
Functions
GetAt
SetAt
ReadString
WriteString
ReadBSTR
WriteBSTR
ReadWORD
WriteWORD
ReadDWORD
WriteDWORD
ReadInterfacePtr
WriteInterfacePtr
Properties
Size
DataPtr
Events Reference
Messenger Events
OnEvent_Signin
OnEvent_SigninReady
OnEvent_Signout
OnEvent_MyStatusChange
OnEvent_MyNameChange
OnEvent_MyPsmChange
OnEvent_MyMediaChange
OnEvent_ContactSignin
OnEvent_ContactSignout
OnEvent_ContactStatusChange
OnEvent_ContactNameChange
OnEvent_ContactPsmChange
OnEvent_ContactMediaChange
OnEvent_ContactBlocked
OnEvent_ContactUnblocked
OnEvent_ContactListWndCreated
OnEvent_ContactListWndDestroyed
OnEvent_ChatWndCreated
OnEvent_ChatWndDestroyed
OnEvent_ChatWndContactAdded
OnEvent_ChatWndContactRemoved
OnEvent_ChatWndReceiveMessage
OnEvent_ChatWndSendMessage
OnEvent_ChatWndEditKeydown
Messenger Plus! Events
OnEvent_Initialize
OnEvent_Uninitialize
OnEvent_MessengerLocked
OnEvent_MessengerUnlocked
OnEvent_Timer
OnEvent_MenuClicked
OnEvent_EnterPersonalizedStatus
OnEvent_LeavePersonalizedStatus
OnEvent_DownloadFileComplete
OnEvent_UploadFileComplete
OnGetScriptMenu
OnGetScriptCommands
Events Templates
ScriptsCommandTemplate
ToastCallbackTemplate
Interface Windows Events
OnWindowidEvent_Cancel
OnWindowidEvent_Destroyed
OnWindowidEvent_MessageNotification
OnWindowidEvent_CtrlClicked
OnWindowidEvent_ComboSelChanged
OnWindowidEvent_EditTextChanged
OnWindowidEvent_LstBoxSelChanged
OnWindowidEvent_LstBoxDblClicked
OnWindowidEvent_LstViewClicked
OnWindowidEvent_LstViewRClicked
OnWindowidEvent_LstViewDblClicked
OnWindowidEvent_LstViewSelStateChanged
XML Schemas Reference
ScriptInfo File
Information
Examples
Schema Documentation
Interface Windows
Information
Examples
Schema Documentation

MsgPlus::UploadFileFTP

The MsgPlus::UploadFileFTP function uploads a file asynchronously to a FTP server. An event is automatically generated when the upload is complete. The function can also be used to test an FTP connection without uploading anything.

Syntax

[boolean] UploadFileFTP(
    [string] SourceFile,
    [string] Server,
    [string] User,
    [string] Password,
    [string] Destination,
    [boolean,optional] PassiveMode,
    [number,optional] Port
);

Parameters

SourceFile
[string] Full path of the file to upload. The file must exist for the upload to succeed. If an empty string is sent in this parameter, the function only checks if the FTP server can be contacted properly.
Server
[string] Host name of the FTP server. It can be an IP address.
User
[string] User name sent to the server to log on.
Password
[string] Password sent to the server to log on.
Destination
[string] Name of the file to create on the FTP server. If SourceFile is empty, this parameter represents the path to check on the server (it can be empty). See remarks.
PassiveMode
[boolean,optional] Specifies if passive mode should be used to connect to the server. Default is true.
Port
[number,optional] Port to connect to on the FTP server. Default is 21.

Return Value

A boolean value specifying if the operation was initiated (file upload of connection check). If the returned value is true, an OnEvent_UploadFileComplete event will be generated once the operation has completed (whether it succeeds or not). Here is a list of possible reasons why this function may return false:

  • The specified SourceFile does not exist.
  • The specified Server is empty.
  • The specified Destination is empty and a SourceFile is specified.
  • Not enough system resources to complete the operation.

Remarks

It is highly recommended to use this function whenever your script needs to upload a file to a FTP server. This function returns as soon as the upload request has been sent to a different thread of execution, guaranteeing that Messenger will not freeze while the server is being contacted. It is important as various network issues can occur while uploading a file on an external server. If the upload is done synchronously with another method, it can result in Messenger freezing for an unspecified amount of time, blocking the user, disturbing Messenger's own network communications and giving the impression that the whole application crashed.

When uploading a file, the specified destination can include a path valid on the server. For example, to create a file called "newfile.dat" in "/dir1/dir2", you would need to specify "/dir1/dir2/newfile.dat" in the Destination parameter. Note that if a path is specified, it must exist on the server. Directories are not created by this function. If a file already exists on the server at the specified destination, it is deleted before the upload of the new file begins. When testing an FTP connection, only directories can be specified here, if needed, to check if a given path exists on the server.

Example

Here is an example that shows how to upload a file to a known FTP server.

function UploadFileToServer(SrcFile)
{
        var Started = MsgPlus.UploadFileFTP(SrcFile, "ftp.srv.com", "user", "pwd", "dest.dat");
        if(Started)
                Debug.Trace("Uploading file, waiting for event");
        else      
                Debug.Trace("Couldn't start the upload");
}

function OnEvent_UploadFileComplete(Server, Destination, Source, Success)
{
        Debug.Trace("UploadFileComplete event received for " + Destination);
        Debug.Trace("   Success: " + Success);
}

Function Information

Object MsgPlus
Availability Messenger Plus! Live 4.60

See Also

MsgPlus Object, OnEvent_UploadFileComplete.