Classes

For each control included into Image Uploader, the iuembed.js exposes an appropriate class:

All these classes have the same members (see below). This reference will mention only ImageUploaderWriter for brevity, however keep in mind that other classes also have members.

Note

Some members have effect on ActiveX or Java version only. The following marking is used.

  • ActiveX label. - a member has effect on ActiveX only.
  • Java label. - a member has effect on Java only.

Members that work for both versions are not marked.

Methods

Name Arguments Description
public method addParam paramName - a parameter name.
paramValue - a parameter value.

Adds a parameter with the specified name and value. It takes into effect when writeHtml or getHtml method is run.

public method addEventListener eventName - an event name.
eventListener - a name or reference to the JavaScript function which is the event listener.

Subscribes the specified JavaScript function to the specified event.

ActiveX label. public method getActiveXInstalled N/A

Verifies whether ActiveX control is installed. If yes, it returns true; otherwise it returns false.

Note

This method works in Internet Explorer only.

ActiveX label. public method getActiveXInstalledToUpdate N/A

Verifies whether ActiveX control is installed and needed to be updated (if an earlier version of the ActiveX control is already installed). If yes, it returns true; otherwise it returns false.

Note

This method works in Internet Explorer only.

public method getControlType N/A

Returns a value that specifies what kind of platform is currently used - ActiveX, Java, or none (i.e. neither ActiveX nor Java can be used in the current browser). It may return one of the following strings:

  • ActiveX
  • Java
  • None
Note

Unlike the controlType property it can be used every time after the writer object is created (not just after the writeHtml or getHtml method call).

Java label. public method getJREInstalled N/A

Verifies whether Java Runtime Environment (JRE) is installed on the current machine. This method returns one of the following values:

  • -2 - JRE is not installed or not enabled;
  • -1 - installed JRE version is less than required;
  • 0 - unable to determine JRE version;
  • 1 - required JRE version is available.
Java label. public method getJREVersion N/A

Returns version number of Java Runtime Environment (JRE) installed on the current machine.

public method getHtml N/A

Generates the HTML code which will embed Image Uploader and returns it as a string. It will write all parameters added with the addParam method and append all event handlers specified by the addEventListener method.

public method getParam paramName - a parameter name.

Returns parameter with a specified name.

public method removeEventListener eventName - an event name.
eventListener - a name or reference to the JavaScript function which is the event listener.

Unsubscribes a specified JavaScript function from a specified event.

public method removeParam paramName - a parameter name.

Removes parameter with a specified name.

public method writeHtml N/A

Generates the HTML code which will embed Image Uploader and writes this code directly into the page. It will write all parameters added with the addParam method and append all event handlers specified by the addEventListener method.

Properties

Name Default value Description
ActiveX label. public property activeXControlCodeBase ImageUploader37.cab

The URL that specifies where to download the ActiveX version of Image Uploader from. It is analogous to the codebase attribute of the OBJECT element.

ActiveX label. public property activeXControlEnabled true

Value that specifies whether to use ActiveX version of Image Uploader. If true, the ImageUploaderWriter analyzes the browser, and if it is Internet Explorer and operating system is Windows, the writeHtml method generates the code for the ActiveX version. For other platform, the code for the Java version is generated. If you want to use the Java version regardless to the browser, set this property to false.

ActiveX label. public property activeXControlVersion empty string

The minimum required version of the ActiveX version (ImageUploader37.cab file). If the user has an older version installed, Internet Explorer downloads the ImageUploader37.cab file from the URL provided by the activeXControlCodeBase property automatically. See the Upgrading Minor Versions topic for more details.

Important

The subversions should be separated only by commas (unlike the Java version). For example, 6,0,10,0.

public property controlType N/A (depends on the browser)

Value that specifies what kind of platform is currently used - ActiveX, Java, or none (i.e. neither ActiveX nor Java can be used in the current browser). It may return one of the following strings:

  • ActiveX
  • Java
  • None
Note

This property can be used only after writeHtml or getHtml method call. If you need to do it before, use the getControlType method instead.

public property height N/A (provided in the constructor)

Height of the control. You should provide an integer number. Syntax like 100% is acceptable, however keep in mind that it is not cross-browser compatible. That is why it is highly recommended to avoid it.

public property id N/A (provided in the constructor)

ID of the control that is used to get a reference with a help of the getImageUploader function.

Java label. public property javaAppletCached true

Value which enables or disables caching for the Java version of Image Uploader. If true, then the caching is enabled, and the Java applet is not re-downloaded until you update it on the server. Otherwise the applet is re-downloaded every time the user visits this page. See the Upgrading Minor Versions topic for more details.

Java label. public property javaAppletCodeBase ./

Path to the virtual directory on your server where ImageUploader37.jar file is located. Unlike activeXControlCodeBase it should be a path to a directory, but not to the file.

Java label. public property javaAppletEnabled true

Value that specifies whether to use Java version of Image Uploader. If true, the ImageUploaderWriter will generate the code for Java version when the ActiveX cannot be used. If false, and the ActiveX version cannot be used, the message stating that the browser is not supported will be displayed.

Java label. public property javaAppletVersion empty string

The minimum required version of the ImageUploader37.jar. If the user has older version installed, the browser downloads the ImageUploader37.jar from the directory specified by the javaAppletCodeBase property. See the Upgrading Minor Versions topic for more details.

Important

If an empty string is specified, applet caching will not work regardless of the javaAppletCached value.

The subversions should be separated only by dots (unlike ActiveX version). For example, 6.0.10.0.

Java label. public property noFileSystemAccessInSafari <p>The browser does not allow Image Uploader to access the local file system. To enable the access perform the following steps:</p><ul><li style='margin-top:10px'>Go to <b>Safari</b>&rarr;<b>Preferences</b>, choose the <b>Security</b> tab, and click <b>Manage Website Settings</b>.</li><li style='margin-top:10px'>Select <b>Java</b> in the left column, click on the dropdown box next to the <b>[name]</b> website, and choose <b>Run in Unsafe Mode</b>.</li></ul>

The message which states that Image Uploader cannot access the local file system due to Safari security settings. It can contain the following placeholder:

[name] replaced by the host name of the currently opened website.

public property showNonemptyResponse off

Specifies whether and how Image Uploader will display a received server response. Possible values are:

  • off
  • alert
  • dump

If off, no response will be shown. If alert, the response will be displayed in an alert window. If dump, the response will be displayed at the bottom of the Web page with Image Uploader.

This feature may be useful when debugging server scripts. See the Debugging Server Scripts topic for more details.

public property width N/A (provided in the constructor)

Width of the control. You should provide an integer number. Syntax like 100% is acceptable, however keep in mind that it is not cross-browser compatible. That is why it is highly recommended to avoid it.

Standalone Functions

Name Arguments Description
public function getImageUploader ID - an ID of the control specified in the ImageUploaderWriter constructor.

Returns a reference to the control by specified ID. Unlike document.getElementById, it overcomes compatibility problems on certain browsers.

Members for Private-Label Versions

When private-label version is used, you need to customize the following properties (that should not be changed in the standard version):

Name Description
ActiveX label. public property activeXControlCodeBase Name of the .cab file.
ActiveX label. public property activeXClassId CLSID of the ActiveX control.
ActiveX label. public property activeXProgId PROGID of the ActiveX control.
Java label. public property javaAppletJarFileName Name of the .jar file.
Java label. public property javaAppletClassName Applet class name.

This code snippet demonstrates how to do it:

JavaScript

<script type="text/javascript">
var iu = new ImageUploaderWriter("ImageUploader1", 610, 500);

iu.activeXControlCodeBase = "MyUploader.cab";
iu.activeXClassId = "B8144F57-C240-4012-A5AE-6E06019EDA5F";
iu.activeXProgId = "MyCompany.MyUploader";
iu.javaAppletJarFileName = "MyUploader.jar";
iu.javaAppletClassName="com.mycompany.myuploader.MyUploader.class";

iu.writeHtml();
</script>

Do not forget to modify these properties for other writer classes if you use them.

See the How to Use Private-label Versions topic for the detailed information on private-label version of Image Uploader.