MFileTransfer

From HTML5 Builder
Jump to: navigation, search

MFileTransfer lets your application upload files to a server.

Usage

Server-Side

The PHP server-side script should use the $_FILES global variable and the move_uploaded_file() function to retrieve the file and store it on the server. For example:

move_uploaded_file($_FILES["file"]["tmp_name"], "/path/on/the/server/for/the.file");

$_FILES contains information about the uploaded file, which you can use to decide the path where you want to store it on the server.

Functions

These are JavaScript functions you can call when you use this component in a screen.

Note: Replace ComponentName with the actual name of the component, that is, the value of its Name property. For example: MFileTransfer1.

ComponentNameUpload
Uploads a file to an web server. You have to pass to this function at least two arguments when you call it: the URI of the local file, and the URL of the external webpage that will manage the upload. The function triggers OnUpload event, or OnUploadError if an error occurs. Upload is done through an HTTP/HTTPS multi-part POST request.

Events

These are JavaScript MFileTransfer events you can associate to JavaScript functions.

OnUpload
This event gets triggered when ComponentNameUpload successfully uploads the local file to the web server.
OnUploadError
This event gets triggered when an error occurs after calling ComponentNameUpload. Its only parameter is a ContactError object.

See Also