1/ Implement the full form in the applet.
It requires to develop a custom UI by implementing TransferUI interface.
Code: Select all
public CustomUI implements TransferUI, ActionListener {
/**
* Call before being visible.
* @param parent
* @param conf
* @param controller
* @return
*/
public boolean init(Container parent, Conf conf, TransferController controller)
{
// Create your field form.
// Swing skills required.
}
public void actionPerformed(ActionEvent evt)
{
// When start upload button is pressed.
// Set which file is media, image and additional
HashMap map = controller.getParameters(null);
map.put("mediafile",themediafilename);
map.put("imagefile",theimagefilename);
map.put("additionalfile",theadditionalfilename);
controller.setSource(List of the 3 files to transfer);
// Trigger upload.
controller.begin();
}
/**
* Call after being visible.
*/
public void start()
{}
/**
* Call before quiting.
*/
public void stop()
{}
}
<PARAM NAME="transferui" VALUE="com.company.CustomUI">
When the applet will load, it will replace the default UI by your custom UI.
Assuming that 3 files have been selected then your server will receive 3 HTTP multipart
requests:
Req1: uploadfile: themediafilenamecontent
mediafile = themediafilename
imagefile = theimagefilename
addtionalfile = theaddionalfilename
Req2: uploadfile: theimagefilenamecontent
mediafile = themediafilename
imagefile = theimagefilename
addtionalfile = theaddionalfilename
Req3: uploadfile: themediafilenamecontent
mediafile = themediafilename
imagefile = theimagefilename
addtionalfile = theaddionalfilename
2/ Keep the fields in an HTML form and extend the JSAPI.
JFileUpload comes with JavaScript API available at:
http://www.jfileupload.com/products/tools/index.html
You could extend it to add the following JavaScript functions:
- setMediaFile(String mediafilepath)
- setImageFile(String imagefilepath)
- setAdditionalFile(String additionalfilepath)
- startUpload()
The you will call these functions from JavaScript. Once startUpload() is called the applet will upload the 3 files.