jquery-file-upload附件上傳

來源:互聯網
上載者:User

標籤:type   style   void   multiple   str   boot   nbsp   body   hold   

引入樣式和js檔案

    <link href="css/bootstrap.min.css" type="text/css" rel="stylesheet"/>      <link rel="stylesheet" href="css/jquery.fileupload.css">      <link rel="stylesheet" href="css/jquery.fileupload-ui.css">       <script src="js/jquery.js"></script>     <script src="js/jquery.ui.widget.js"></script>      <script src="js/jquery.fileupload.js"></script>  

html

<body>  <div class="row fileupload-buttonbar" style="padding-left:15px;">      <div class="thumbnail col-sm-6">        <img id="weixin_show" style="height:180px;margin-top:10px;margin-bottom:8px;"  src="__PUBLIC__/images/game/game_1.png" data-holder-rendered="true">        <div class="progress progress-striped active" role="progressbar" aria-valuemin="10" aria-valuemax="100" aria-valuenow="0">        <div id="weixin_progress" class="progress-bar progress-bar-success" style="width:0%;"></div>      </div>        <div class="caption" align="center">          <span id="weixin_upload" class="btn btn-primary fileinput-button">          <span>上傳</span>          <input type="file" id="weixin_image" name="files" multiple>          </span>          <a id="weixin_cancle" href="javascript:void(0)" class="btn btn-warning" role="button" onclick="cancleUpload(‘weixin‘)" style="display:none">刪除</a>      </div>      </div>    </div> </body>

上傳ajax:

    <script type="text/javascript">      $(function() {            $("#weixin_image").fileupload({                    url: ‘http://www.test007.com/ser/api/json/file/upload/batch‘,                    sequentialUploads: true                }).bind(‘fileuploadprogress‘, function (e, data) {  //主要是進度條的修改                  var progress = parseInt(data.loaded / data.total * 100, 10);                    $("#weixin_progress").css(‘width‘,progress + ‘%‘);                    $("#weixin_progress").html(progress + ‘%‘);                }).bind(‘fileuploaddone‘, function (e, data) {  //上傳結束後執行的操作                  var imgurl = JSON.parse(data.result).data;                  $("#weixin_show").attr("src", imgurl);                    $("#weixin_upload").css({display:"none"});                    $("#weixin_cancle").css({display:""});                });                               });    </script>

 

jquery-file-upload附件上傳

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.