上傳檔案外掛程式dropzone的執行個體

來源:互聯網
上載者:User

標籤:span   func   ctf   接受   cli   最大   over   上傳檔案   new   

html:

<div class="field">
  <div id="file" class="dropzone">
    <div class="dz-message needsclick">
      <font><font>Drop files here or click to upload.</font></font><br>
      <span class="note needsclick">(Select the files you want to upload.)</span>
    </div>
  </div>
</div>

css:

.field{
  max-width:720px;
  margin:0 auto;
  margin-top:60px;
  font-size:20px;
  .dropzone{
    padding: 54px 54px;
    .dz-message{
      height:84px;
      font{
        line-height:28px;
      }
      span.note{
        height:28px;
        margin-top:28px;
        font-size:15px;
      }

    }
  }
}

js:

Dropzone.autoDiscover = false;
var dropz = new Dropzone("#file", {

       url: "uploadFile", //上傳檔案的介面

   parallelUploads:10,//平行處理多少個檔案上傳
   uploadMultiple:true,//允許dropzone一次提交多個檔案
   maxFiles: 10,//最大可上傳的檔案個數
   maxFilesize: 10,//MB
   acceptedFiles: ".csv", //可接受的檔案類型
   success:function(file,data){
     // console.log(this.getAcceptedFiles().length);//擷取上傳的檔案總數
     data=JSON.parse(data);
     if(data.code==‘000‘){
      //成功
     }else{
     }
   },
   dictMaxFilesExceeded:"檔案數量過多",
   dictDefaultMessage:"Drop files here or click to upload.",
   dictFileTooBig:"可添加的最大檔案大小為{{maxFilesize}}Mb,當前檔案大小為{{filesize}}Mb ",
})

dropzone需要注意的一點就是:

  開啟檔案的那一刻,就已經開始上傳了

官網地址:http://www.dropzonejs.com/

 

上傳檔案外掛程式dropzone的執行個體

相關關鍵詞:
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.