Using HTTP for Image Upload in Ephox EditLive! for Java

Overview

When inserting and uploading images to a remote server, Ephox EditLive! for Java uses the HTTP POST protocol for greater security. The following properties are defined in the .xml configuration file for this purpose.

More Information

Why use HTTP?

Using the HTTP POST method to insert and upload images offers a secure way of allowing end users to interact with the remote server that the images are to be stored on. 

What is Required?

In order to upload local images to the remote server via HTTP, you will need a server-side image upload handler script that accepts the images on the server and stores them in the correct directory. This script is the same script that would be used for uploading any file to the server via the HTTP POST method. For example, when you use a file input element (i.e. <INPUT type="file">), the script specified in the ACTION attribute of the form element is used to upload the file to the server. This is the same script specified in EditLive! for Java to upload local images inserted into EditLive! for Java to the remote server.

Writing an Image Upload Script

EditLive! for Java can use any image upload script that complies with RFC for Form-based File Upload in HTML (RFC 1867).

EditLive! for Java HTTP Image Upload Configuration

The following settings for image upload must be set up in the Configuration Tool, in order to get image upload working correctly. 

HTTP Image Upload - URL

You should enter in this field the absolute URL of the image upload handler scripts to be used for uploading.

    Example

    URL = http://www.yourserver.com/scripts/someuploadscript

Note:  Relative URLs may be used.  In this case the URL will be relative to the location of the page in which EditLive! for Java is embedded. 

HTTP Image Upload - BASE

You should enter in this field the absolute URL for where the images are to be uploaded. The images can then be found by directing your browser to the images directory of the URL you supplied, after they have been uploaded.

    Example

     BASE = http://www.yourserver.com/userimages/ 

Note:  Relative URLs may be used.  In this case the URL should be relative to the page which will be used to display the finished documents.  For the images to be displayed correctly in the pages in which EditLive! for Java is embedded, the relative URL should also be the correct location relative to the pages in which EditLive! for Java is embedded.

Example

If the location of the display page directory is: http://myserver.com/editlivejava/somesite/site

The location of the directory where the images are stored is: http://myserver.com/editlivejava/somesite/site/images

The location of the directory containing the pages with EditLive! for Java embedded in them is: http://myserver.com/editlivejava/somesite/cms

Then the correct relative BASE URL location for both the viewing and editing pages to function correctly with images would be: ../site/images

We recommend using absolute URLs when possible, as it is less likely to lead to confusion.

When are Images Actually Uploaded?

Images are uploaded when the contents of EditLive! for Java are submitted.  This occurs when the form which contains EditLive! for Java has its submit method called.

Common Problems

There are a number of problems that may occur while attempting to use HTTP Image Upload. These can be complicated and are chiefly to do with the settings on your server of choice.

See Also