FramedPanel fp=new FramedPanel();
fp.setHeaderVisible(false);
fp.setButtonAlign(BoxLayoutPack.CENTER);
final FormPanel panel = new FormPanel();
panel.setAction("upload.do?type="+type+"&id="+id);
panel.setEncoding(Encoding.MULTIPART);
panel.setMethod(Method.POST);
fp.add(panel);
file = new FileUploadField();
file.setAllowBlank(false);
file.setName("uploadedfile");
panel.add(new FieldLabel(file,"选择文件"));
TextButton btn = new TextButton("重置",new SelectHandler() {
public void onSelect(SelectEvent event) {
panel.reset();
}
});
fp.addButton(btn);
btn = new TextButton("上传",new SelectHandler() {
public void onSelect(SelectEvent event) {
if (panel.isValid()) {
panel.submit();
return;
}
}
});
fp.addButton(btn);
panel.addSubmitCompleteHandler(new SubmitCompleteHandler() {
public void onSubmitComplete(SubmitCompleteEvent event) {
String html=event.getResults().trim();
if(html.contains("[[uri=")){
if(callback!=null){
String value=html.substring(html.indexOf("[[")+6, html.indexOf("]]"));