|
JavaPowUpload 2.0
FAQ |
Home
page Contact
support
|
JavaPowUpload Frequently Asked Questions (FAQ)
This section describe how to use JavaPowUpload applet and answer on Frequently Asked Questions.
2. How to include JavaPowUpload applet on page?
4. How to specify files for downloading?
5. How to use JavaPowUpload events and methods?
6. How to register JavaPowUpload?
7. How to hide my SerialNumber on web page?
8. How to redirect user to another page when upload/download process is complete?
9. How to send information about upload/download process results to server?
11. How to send additional information to server?
1. JavaPowUpload display message "This copy of JavaPowUpload software registered to another domain...". What to do?
Unfortunately client-side controls like Java applet are defenseless of page source view and copying.
So starting version 2.0 JavaPowUpload includes domain name hash at the serial key.
You should enter your domain name while purchase.
If you have single domain license and changed your domain you should buy another license or pay domain change fee at the purchase page or upgrade single domain license to the enterprise (unlimited domains) at the upgrade page.
You can use JavaPowUpload at the tesing site/server for free. Just close the alert window after it occures or remove serial number from parameters to make JavaPowUpload work as trial.
2. How to include JavaPowUpload applet on page:
<applet code="com.elementit.JavaPowUpload.Manager" archive="lib/JavaPowUpload.jar, lib/skinlf.jar, lib/commons-logging-1.1.jar, lib/commons-httpclient-3.1-rc1.jar, lib/commons-codec-1.3.jar, lib/commons-net-ftp.jar" width="600" height="400" name="JavaPowUpload" id="JavaPowUpload" mayscript="true" alt="JavaPowUpload by www.element-it.com"> <!-- Java Plug-In Options --> <param name="progressbar" value="true"> <param name="boxmessage" value="Loading JavaPowUpload Applet ..."> <!-- JavaPowUpload parameters --> <param name="Common.UploadMode" value="true"> <param name="Upload.UploadUrl" value="FileProcessingScripts/ASP.NET/CSharp/uploadfiles.aspx"> <param name="Common.SkinLF.ThemepackURL" value="lib/themepack.zip"> Your browser does not support applets. Or you have disabled applets in your options. To use this applet, please install the newest version of Sun's java. You can get it from <a href="http://www.java.com/">java.com</a> </applet>applet
The Applet tag tells the browser that a Java-Applet should be embedded here. The attributes have all required information for Java to find and run the specified Applet from the given archive.
name, id
The name and id of the Applet, that JavaScript is using to access JavaPowUpload.
code
The code tag specifies the location and name of the main class, com.elementit.JavaPowUpload.Manager for javaPowUpload.
archive
The archives contain the applet and further classes that are required by JavaPowUpload.
Note: if only download functionality of JavaPowUpload is used, following archives can be ommited:
lib/commons-logging-1.1.jar
lib/commons-httpclient-3.1-rc1.jar
lib/commons-codec-1.3.ja
If skin support not needed, lib/skinlf.jar can be ommited. If FTP, FTPS support not needed, lib/commons-net-ftp.jar can be ommited.width, height
These two attributes specify the dimension (size) of the JavaPowUpload applet.
mayscript
This toggles wether or not JavaScript is allowed to call methods of the JavaPowUpload applet. If this attribute is ommited, JavaScript events and functions will not work.
param
The <param> tags can be used to configure the JavaPowUPload applet. All supported parameters are described in the parameters section. Names and values must be quoted. Also note that the names and values are case-sensitive.
3. How to setup parameters
Parameters can be specified using 3 ways:
1. Using <param> tag of the <applet> tag.
2. Using external xml file, specified with Common.PropertiesFile parameter in <applet> tag.
Example of properties.xml file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <entry key="Common.UploadMode">true</entry> <entry key="Common.BackgroundColor">#FFFFFF</entry> <entry key="Common.UseLiveConnect">true</entry> </properties>3. Using JavaScript setParam method.
Example:
JavaPowUpload.setParam("Upload.UploadUrl","http://localhost/JavaPowUpload/uploadfiles.php");Parameters specified using setParam method have highest priority, specified in <applet> tag have lowest priority.
4. How to specify files for downloading
There is 2 ways:
1. Xml file with file structure for download, specified with Download.DataURL parameter.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<download>
<folder name="Folder">
<folder name="SubFolder">
<file name="Simplefile.txt" id="1" length="1240">
<url>SampleFiles/textfile.txt</url>
</file>
<file name="SimpleArchive.zip" id="2" length="488">
<url>SampleFiles/archive.zip</url>
</file>
</folder>
<file name="UncompressArchive.zip" id="3" length="488" uncompress="true" delete="true">
<url>SampleFiles/archive.zip</url>
</file>
</folder>
</download>As you can see in this example, there is the root element download.
You can add folders via the folder element. The attribute name specifies the name of the folder,
which will be created on th eclient side.Folders can have nested subfolders.
Downloadable items are specified by the file element, which also has an attribute name for spe-
cifying the filename on the client side.Files can have a following attributes:
length - file size.
id - custom identifier.
uncompress - determines whether JavaPowUpload should uncompress zip archive after downloading or not.
delete - determines whether JavaPowUpload should delete zip archive after unpacking or not.
Files cannot have any children elements like file or folder, but they do have a source address.
The source URL of the file to download is specified via an url element.
The url element specifies an absolute URL to the file, but might also be relative to the codebase
URL. The codebase URL is the URL where the applet is loaded from.
If, for example, the JavaPowUpload component is installed to
http://www.example.com/downloads/JavaPowUpload.jar
the codebase URL is
http://www.example.com/downloads/2. Specify file structure for download via parameters.
Example:
<param name="Folder_0" value="Test folder">
<param name="File_0" value="Textfile.txt">
<param name="File_0.url" value=SampleFiles/textfile.txt">
<param name="File_0.parent" value="Folder_0">
<param name="File_0.length" value="1240">
<param name="File_1" value="SampleArchive">
<param name="File_1.url" value="SampleFiles/archive.zip">
<param name="File_1.parent" value="Folder_0">
<param name="File_1.length" value="488">
<param name="File_1.uncompress" value="true">
<param name="File_1.delete" value="false”>Format of names: <FILE || FOLDER>_<INDEX>.<ATTRIBUTE> .
Attributes for files and folders are the same as in xml file, except following:
file and folder names should be specified directly in value attribute of corresponding <param> tag,
parent attribute should be specified for all nested files or folders, otherwise they will be added to the root of tree.
5. How to use JavaPowUpload events and methods
1. You should set mayscript attribute for <applet> tag.
2. Set JavaPowUpload parameter Common.UseLiveConnect to true (false by default) .
3. Set JavaPowUpload parameter Common.JavaScriptEventsPrefix to needed value ("JavaPowUpload_" by default) .
To use javaPowUpload events you should declare appropriate JavaScript functions. Function name format is Common.JavaScriptEventsPrefix+eventName. List of all available JavaPowUpload events available in events section.
Example:
function JavaPowUpload_onDownloadStart()
{
alert("Starting download process");
}To use JavaPowUpload methods, yo should init JavaPowUpload object.
Example:
//init JavaPowUpload JavaScript object
Java = document.getElementById("JavaPowUpload");
//where "javaPowUpload" is id attribute of <applet> tag>
//Now we can use javaPowUpload methods, for example show browse dialog
Java.clickBrowse();
6. How to register JavaPowUpload
You can make JavaPowUpload trial to work as full by setting parameter Common.SerialNumber .
7. How to hide my SerialNumber on web page?
If you set Common.SerialNumber property on web page inside <applet> tag , anyone can view html source code and get your SerialNumber. We understand this situation and recommend you to place SerialNumber in external xml file with properties. Specify URL to this file by Common.PropertiesFile property.
Set some filters on web server which allow access this xml file only if it is requested by JAVA (for example, filter by user-agent header).
Starting from version 2.0 domain license will work only on the domain specified while purchase.
8. How to redirect user to another page when upload/download process is complete?
Specify the property Common.FinishUrl to url of the page which should be loaded when upload/download process is complete.
JavaPowUpload does not post any information to this page. You may also configure a target where this page should be loaded using the property Common.FinishUrl.Target ("_self" by default).
9. How to send information about upload/download process results to server?
JavaPowUpload can post information about download/upload process results to server when upload/download process is complete.
Specify the property Common.ResultUrl - URL to a necessary web page. This URL will be loaded by JavaPowUpload and not by browser.
JavaPowUpload sends the following info about each file:
- Name of destination folder (only in download mode)
- File path. In download mode value is a file download url, in upload mode - full file path.
- File status.
10. How to upload thumbnails?
To enable file thumbnail upload feature, set Upload.Thumbnails.Upload to true.
Specify Upload.Thumbnails.Height and Upload.Thumbnails.Width properties to necessary values.
If you need to upload original image, set Upload.Thumbnails.UploadOriginalFile to true.
JavaPowUpload supports the following image formats for thumbnail generation: JPG (by default) , PNG, BMP.
You can change thumbnail format specifying Upload.Thumbnails.Format property.
11. How to send additional information to server?
You can send additional information in several ways:
- a. Add info to Upload.UploadUrl property.
For example:
<param name="Upload.UploadUrl" value="uploadfiles.php?paramname1=value1¶mname2=value2">- b. Specify Upload.HttpUpload.FormName property.
In this case you can add a form to your html page and JavaPowUpload will automatically add form values to HTTP request.
- c. Specify Upload.HttpUpload.CustomPostFields property.
Array of custom fields and values that will be added to the request separated by ;
Example:
filedName1=value1;FieldName2=value2- d. Use JavaScript addPostField(String name, String value) method.
It adds “name–value” pair to the list that will be sent as text Form items. Actually this method appends "name=value" string in the end of Upload.HttpUpload.CustomPostFields property.Example:
JavaPowUpload.addPostField("Username","JDoe");