Back to product page

SendFile method


Sends file to contact.

Syntax

  • Basic
object.SendFile (Contact, Filename, Description)
The SendFile(object,Contact,Filename,Description) syntax has these parts:
objectAn expression evaluating to an object of type wodXMPP
ContactA Variant value. Reference to the contact, or his JID.
FilenameA String value. Full path to the file that will be sent.
DescriptionCan be empty. Holds user-friendly description of the file, to be shown to remote side.

Remarks

SendFile method initiates file transfer to remote contact. wodXMPP will negotiate transfer parameters and will determine which protocol to use for file transfer. When transfer is about to start, FileTransferStart event will fire where you can change, for example, DataIP if you want to force connection to different IP than provided by wodXMPP itself.
After SendFile is called, it is possible that wodXMPP first sends request to remote contact to provide features it supports so wodXMPP can determine which protocol to use. That may slow down start of the first file transfer in that session, but only for short period of time (up to few seconds).
When transfer finishes, FileTransferEnd will fire, providing with possible ErrorCode and ErrorText description, if error occurred.
You can also use FileTransferProgress method to monitor progress of the file transfer.

Return value of SendFile method is newly created XMPPFile object, where you can set up other properties, or access them if needed. Even after calling SendFile you can adjust returned File's properties since upload request is not already sent - it will take few milliseconds before it is sent, so there is time to tweak your code (such as, to change MimeType property).

Platforms

Windows