Upload Images

To upload images in the editor you need to set up the upload option at initialization.

$RE('#myemail', {
    path: '/revolvapp-dist/',
    template: '/my-folder/template.html',
    upload: '/my-backend-upload/'

Now catch the uploaded file in your backend. Here is a simple example for PHP:


if (isset($_FILES['file']))
    // setting file's mysterious name
    $id = md5(date('YmdHis').$_FILES['file']['name']);
    $filename =  $id.'.jpg';
    $newfile = $dir.$filename;

    // copying
    move_uploaded_file($_FILES['file']['tmp_name'], $newfile);

    // displaying file
    $files = [
        'url' => '/my-images/'.$filename

echo stripslashes(json_encode($files));


The upload script must returns JSON with the url of the uploaded image like this:

    "url": "/my-images/image-name.jpg"