Uploaded files identification

Upload core product.
User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Uploaded files identification

Post by support »

I understand your need. To have a user-friendly form as you've designed there are 2 solutions (see below). Both requires Java/Swing skills. They relies on the JFileUpload API (available with JFileUpload Enterprise).

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()
    {}
   } 
  
Then you can declare your CustomUI in the JavaScript:
<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.

Post Reply