コード例 #1
1
ファイル: UploadComposer.java プロジェクト: pkdevboxy/zats
 @Listen("onUpload = #btn, #uploadBox")
 public void upload(UploadEvent event) {
   results.getChildren().clear();
   org.zkoss.util.media.Media[] medias = event.getMedias();
   if (medias != null) {
     for (int i = 0; i < medias.length; ++i) show(i, medias[i]);
   }
 }
コード例 #2
1
  public void onUpload$button_Lampiran(UploadEvent event) throws IOException {
    Media media = event.getMedia();
    // allowed_types : zip/ rar/ word/ excel/ pdf/ txt.
    String file = media.getName();
    int zip = file.indexOf("zip");
    int rar = file.indexOf("rar");
    int doc = file.indexOf("doc");
    int docx = file.indexOf("docx");
    int xls = file.indexOf("xls");
    int xlsx = file.indexOf("xlsx");
    int pdf = file.indexOf("pdf");

    if (zip != -1 || rar != -1 || doc != -1 || docx != -1 || pdf != -1 || xls != -1 || xlsx != -1) {
      setUploadMedia(media);
      label_viewAttachment.setValue(file);
    } else {
      alert("Silahkan gunakan format : zip/ rar/ word/ excel/ pdf");
    }
  }