Documentation

Upload Images

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

Revolvapp('#myemail', {
    editor: {
        path: '/revolvapp-dist/',
        template: '/my-folder/template.html'
    },
    image: {
        upload: '/my-backend-upload/'
    }
});

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

<?php
$file = [];
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
    $file = [
        'url' => '/my-images/'.$filename
    ];
}

echo stripslashes(json_encode($file));

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

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