| Commonly the requirement would be that a big File has to be uploaded to the FTP Server through a Client Application (Applet) running in the Browser. One of the main constraint Java puts is that a client side resources cannot be accessed from your application. If you want to write such an Application, you have to use an Applet. This applet should be a signed Applet for which you can contact VeriSign Inc. |
| A Signed Applet is basically a kind of authorisation to the Applet or Application to access the Client Machine. The client will be warned about this kind of Application downloaded to his system which he will authorise or deny. |
Click here for steps to sign an Applet |
Click here to download the FTPApplet.jar |
| Since the Applet is signed, we need to have the Java 1.3 Plug-in to be installed in the Client Machine Browser. So we have to ensure that the plug in is downloaded to the Client machine using different HTML Tags. |
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" id="FTPApplet" mayscript="true" width="550" height="24" name="FTPApplet" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_01a-win.cab#version=1,3,1,1"> <PARAM name="CODE" value="FTPApplet.class" > <PARAM name="NAME" value="FTPApplet"> <PARAM name="ARCHIVE" value="/jars/FTPFile.jar"> <PARAM name="type" value="application/x-java-applet;version=1.3"> <PARAM name="scriptable" value="true"> <PARAM name="MAYSCRIPT" value="true"> <EMBED scriptable="true" mayscript="true" name="FTPApplet" id="FTPApplet" code="FTPApplet.class" archive="/jars/FTPFile.jar" src="FTPApplet.class" pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html" type="application/x-java-applet;version=1.3" width="550" height="24"> </EMBED> </OBJECT> Note: If you try to change the Tags something like <OBJECT> ... </OBJECT> and then the EMBED Tag, Netscape does not recognise ... |
|
IE recognises the <OBJECT> Tag and Netscape browser recognises <EMBED> Tag. The main problem is accessing the tags elements from Javascript to activate the Applet to start uploading the file through FTP. IE supports something like : document.FTPApplet.object.startUpload(); But accessing the EMBED Tag from netscape in the same way was a big trouble. document.FTPApplet.startUpload(); where startUpload() is a method in the Applet. |
| Since this techinque didnt work out for Netscape, we tried some other different work around to do the same. We knew that the Applet would be running at the Client machine. So what we did was that when the Applet gets downloaded, in the init() method we run a Thread to poll for a Hidden Parameter in the Html Screen. This Thread is stopped when the Hidden parameter gets toggled to indicate that the FTP Upload Button has been clicked by the User. |
| Once we know that the Hidden Parameter has been toggled, we start the Upload activity... |
Contact me at pazhanikanthan if you have any further doubts. |