Add file
This action allows you to add an entire file to the end of the current binary data.
It takes one parameter, which is the file path to add.
In Lacewing Blue Client b100 and later, this file path can be an embedded file; it will be extracted by Blue if necessary.
For paths based on your app's location, there is a "Expression" or "Use an expression" button on the bottom of the file dialog, letting you give evaluated paths, such as those using AppPath$.
Using a filename received from a client/server message is unsafe. To use filenames safely, read Security > Safe filenames section.
You shouldn't send large files all at once – even though by Relay message specs you can pack up to 2,147,483,647 bytes (approx. 2 gigabytes) in one message, your app will probably run out of memory with much smaller files.
If it didn't, your app will most likely freeze for a long duration as it reads from the disk, and that will cause a server disconnect from timeout; and if that didn't happen, you may get a server disconnect from violating the server's message size limits.
If you intend to send large files, you should break the file up into smaller chunks and send it in parts. Consider using Binary Quickload and Binary object, with the Add binary action, instead. Quickload can also load parts of a file as well.
Remember, the Sent messages are guaranteed to arrive in the same order they were sent. Don't forget to space out your messages using Every X/100 seconds, don't just send the whole file's chunks in a fastloop, or you'll get the same issues as if you sent it in one big message.
You may want to refer to the Expert: Sending a big file with compression example.
HTML5/UWP warning
This action will not work in Blue Client HTML5/UWP; it will create an error instead. Consider using the Binary to send > Add binary action instead.
If you want files uploaded from a URL or from the user's disk by opening a file selector dialog, contact Phi to have this feature implemented.
Otherwise, to access the binary-to-send message in HTML5/UWP, you can use:
read: client['GetSendMsg']() – will return a Uint8Array
write: client['SetSendMsg'](Uint8Array)