The processing file on the server (*.receive.js)

The *.receive.js files are handlers for actions on the server called by the client by calling the Wrapper.send() method

The *.receive.js file is created either by the SublimeFCFPlugin, VSCodeFCFFramework plugins or by command:

$ fcfmngr create receive [TEMPLATE_NAME]


TEMPLATE_NAME - Template name

Here's an example of a *.receive.js file for a template :templates/pages/template.tmpl

fcf.module({ name: "templates/pages/template.receive.js", dependencies: [], lazy: [], module: function() { return class Handler { receive(a_fields, a_files){ } } } });

The *.receive.js file is an FCF module that exports a class that must contain a receive method that handles the request.

Receive method signature:

mixed receive(object a_fields, [object] a_files)


object a_fields - object dispatched by Wrapper.send()

[object] a_files - array with information about uploaded files:

int size - file size

string path - the path to the file

string name - Filename passed by client

object attributes - DOM attributes of the input object passed to the Wrapper.send() method

The return value is passed to the client as the result of executing the Wrapper.send() method. The receive method can be asynchronous.