form.setEncodingType("multipart/form-data");
    protected SComponent createUpload() {        SForm form = new SForm(new SFlowDownLayout());        form.setBorder(new SEmptyBorder(10, 5, 0, 0));        form.setEncodingType("multipart/form-data");        chooser = new SFileChooser();        form.add(chooser);        SButton submit = new SButton("upload");        submit.setVerticalAlignment(RIGHT);        form.add(submit);        SPanel p = new SPanel(new SGridLayout(2));        p.setBorder(new SEmptyBorder(10, 5, 0, 0));        p.add(new SLabel("message:"));        final SLabel message = new SLabel("");        p.add(message);        p.add(new SLabel("filename:"));        final SLabel filename = new SLabel("");        p.add(filename);        p.add(new SLabel("fileid:"));        final SLabel fileid = new SLabel("");        p.add(fileid);        p.add(new SLabel("filetype:"));        final SLabel filetype = new SLabel("");        p.add(filetype);        p.add(new SLabel("size:"));        final SLabel size = new SLabel("");        p.add(size);        form.add(p);        form.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                try {                    if (chooser.getFile() != null) {                        message.setText("OK");                        message.setBackground(null);                        filename.setText(chooser.getFileName());                        fileid.setText(chooser.getFileId());                        filetype.setText(chooser.getFileType());                        size.setText("" + chooser.getFile().length());                        adaptPreview();                    } else {                        message.setText("No file chosen");                        message.setBackground(WARN_COLOR);                    }                } catch (IOException ex) {                    message.setText(ex.getMessage());                    message.setBackground(WARN_COLOR);                    filename.setText("");                    fileid.setText("");                    filetype.setText("");                    size.setText("");                    contentSwitcher.show(unknownLabel);                }                chooser.reset();            }        });        form.setVerticalAlignment(TOP);        return form;    }