隨筆 - 7  文章 - 3  trackbacks - 0
          <2013年5月>
          2829301234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          常用鏈接

          留言簿

          隨筆檔案

          文章分類

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜


          多文件上傳 jquery的插件
          使用的方法  導入 jquery.js 及 jquery.MultiFile.js ,
          方式一: 后臺是文件數組  
           private File[] upload; // 與jsp表單中的名稱對應
           private String[] uploadFileName;
           private String[] uploadContentType;
          在 form 中加入 <input type="file" name="upload[]" class="multi" /> 即可。

          方式二:后臺是List<File>
           private List<File> upload; // 與jsp表單中的名稱對應
           private List<String> uploadFileName;
           private List<String> uploadContentType;

          jquery.MultiFile.js  將選中的文件列在From中,名字為upload的<input>,所以要用 name="upload[]"(方法一)或者name="upload" (方法二) 來接收
          class="multi" 是 jQuery 用來作的文件類型,HTML 部份代碼如下:

          <head>
          <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
          <title>Untitled Document</title>
          <script src="/multiple-file-upload/jquery.js" type="text/javascript" language="javascript"></script>
          <script src="/multiple-file-upload/jquery.MultiFile.js" type="text/javascript" language="javascript"></script>

          </head>
          <body>

          <form enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
          <input type="file" name="upload[]" class="multi" maxlength="2"/>
          //<input type="file" name="upload" class="multi" />

          <input type="submit" value="Upload File" />
          </form>

          </body>

          參數說明:

          參數 說明 說明
          class="multi" maxlength="2" Limit: 2 files.
          Allowed extensions: any.
          限制數量2
          class="multi" accept="gif|jpg" Limit: no limit.
          Allowed extensions: gif and jpg.
          格式只能 gif  jpg
          class="multi" accept="gif|jpg" maxlength="3" Limit: 3 files
          Allowed extensions: gif, jpg.
          限制數量3,格式只能 gif  jpg


          主頁:http://www.fyneworks.com/jquery/multiple-file-upload/

          下載:http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Download

          示例:http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Examples

          posted on 2013-05-17 15:56 Tomas 閱讀(4191) 評論(2)  編輯  收藏

          FeedBack:
          # re: 多文件上傳 2013-05-19 09:23 11
          01.Ext.getCmp('collect_task_form').getForm().load({
          02. url: "./collectTaskView.do"
          03. ,params: {
          04. id: id
          05. }
          06. ,success: function(form, action){
          07. //Ext.example.msg('編輯', '載入成功!');
          08. //alert(Ext.getCmp("data").getValue());
          09. var o = Ext.util.JSON.decode(action.response.responseText);
          10. if (o) {
          11. var root = o.root;
          12. var pack = root[0];
          13.
          14. alert(pack.displayName);
          15. }
          16. }
          17. ,failure: function(form, action){
          18. Ext.MessageBox.show({
          19. title: '錯誤',
          20. msg: '出現異常創建失敗,請與管理員聯系.',
          21. buttons: Ext.MessageBox.OK,
          22. icon: Ext.MessageBox.ERROR
          23. });
          24. }
          25. ,waitMsg: "正在加載數據,請稍候..."
          26. });
            回復  更多評論
            
          # re: 多文件上傳 2013-05-19 09:23 11
          Formpanel中必須有
          reader: new Ext.data.JsonReader({root:'root'},
          [{name: 'pack',mapping:'pack',type:'string'}
          ])
            回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 顺昌县| 财经| 六盘水市| 白银市| 清徐县| 静宁县| 邳州市| 松滋市| 勐海县| 阿拉尔市| 布拖县| 务川| 新田县| 遵义县| 玉门市| 桓仁| 隆子县| 冕宁县| 临邑县| 奉化市| 萝北县| 闵行区| 晋城| 大方县| 聊城市| 革吉县| 云霄县| 景洪市| 万全县| 尼玛县| 塘沽区| 株洲县| 图片| 永修县| 江北区| 金沙县| 鸡泽县| 泰州市| 金门县| 苏尼特右旗| 盐边县|