Upload file as attachment

This example shows how to upload files with Redactor to the attachment area.

    Demo

    Code

    <!-- file attachments layer -->
    <div id="file-target"></div>
    
    <!--element -->
    <textarea id="content"></textarea>
    
    <!-- call -->
    <script>
    $R('#content', {
        fileUpload: '/your-upload-script/',
        fileAttachment: '#file-target'
    });
    </script>
    
    <!-- server response json -->
    {
        "file": {
            "url": "some-file-url",
            "name": "some-file-name",
            "id": "some-id"
        }
    }