茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    PHP MVC框架skymvc支持多文件上傳
    來源:易賢網(wǎng) 閱讀:1171 次 日期:2016-08-18 16:22:36
    溫馨提示:易賢網(wǎng)小編為您整理了“PHP MVC框架skymvc支持多文件上傳”,方便廣大網(wǎng)友查閱!

    本文實(shí)例為大家分享了skymvc實(shí)現(xiàn)文件上傳的具體代碼,供大家參考,具體內(nèi)容如下

    1.代碼upload.ctrl.php     

    <?php

    class uploadControl extends skymvc{

     public function __construct(){

      parent::__construct();

     }

     public function onDefault(){

      $this->smarty->display("https://upload.ynpxrz.com/upload/default.html");

     }

     public function onUpload(){

      $this->loadClass("upload");

      //上傳的文件目錄

      $this->upload->uploaddir="attach/my/";

      //允許上傳的文件大小

      $this->upload->maxsize=4194304000;

      //是否上傳圖片

      $this->upload->upimg=true;

      //設(shè)置允許上傳的文件類型

      $this->upload->sysallowtype=array('gif','jpg','bmp','png','jpeg','txt','mpeg','avi','rm','rmvb','wmv','flv','mp3','wav','wma','swf','doc','pdf','zip','tar','svg');

      $this->upload->allowtype=$this->upload->sysallowtype;

      //根據(jù)Id存儲(chǔ)

      $this->upload->iddir=0;

      $data=$this->upload->uploadfile("upimg");

      //print_r($data);

      echo json_encode($data); 

     }

    }

    ?>

    2.代碼upload.html     

    <!doctype html>

    <html>

    {include file="head.html"}

    <body>

    {include file="header.html"}

    <div class="main-body box960">

     <form method="post" action="/index.php?m=upload&a=upload" enctype="multipart/form-data">

     <div class="row">

      <div class="btn-upload">

       <i class="iconfont icon-upload"></i>

       上傳文件

       <div class="btn-upload-file">

        <input type="file" id="upimg" name="upimg" multiple>

        </div>

      </div>

     </div>

     <div style="height:10px;"></div>

     <div class="row">

     <input type="submit" class="btn" value="上傳">

     </div>

     </form>

     <h3>上傳結(jié)果</h3>

     <div class="result" id="result"></div>

    </div>

    {include file="footer.html"}

    <style>

     .result{border:1px solid #ccc; padding:5px;}

     .result div{line-height:24px;}

     .result .e{color:#D58384;}

     .result .s{color:#59A42A;}

    </style>

    <script src="/static/js/skyupload.js"></script>

    <script>

     $(document).on("change","#upimg",function(data){

      skyUpload("upimg","/index.php?m=upload&a=upload&ajax=1",function(e){

       var data=eval("("+e.target.responseText+")");

       if(data.err){

        $("#result").append('<div class="e">error:'+data.err+'</div>');

       }else{

        $("#result").append('<div class="s">success:'+data.filename+'</div>');

       }

      });

     });

    </script>

    </body>

    </html>

    3.PHP代碼

    function skyUpload(upid,url,success,error,uploadProgress)

    {

       var vFD = new FormData();

       var f= document.getElementById(upid).files;

       $("#"+upid+"loading").show();

       for(var i=0;i<f.length;i++){ 

       vFD.append('upimg', document.getElementById(upid).files[i]);

       var oXHR = new XMLHttpRequest();  

       oXHR.addEventListener('load', success, false);

       oXHR.addEventListener('error', error, false);

       if(uploadProgress!=undefined){

        oXHR.upload.addEventListener("progress", uploadProgress, false);

       }

       oXHR.open('POST',url);

       oXHR.send(vFD);

       }

    }

    /*

    function uploadFinish(e){

      var data=eval("("+e.target.responseText+")");

      $("#uploading").hide()

      if(data.error != '')

      {

       skyToast(data.msg);

      }else

      {

       $("#imgShow").html("<img src='/"+data.imgurl+".100x100.jpg' width='100'>");

       $("#imgurl").val(data.imgurl);

       }

    }

    function uploadError(e) { // upload error

      skyToast("上傳出錯(cuò)了");

    }

    */

    以上就是本文的全部內(nèi)容,希望對(duì)大家學(xué)習(xí)php程序設(shè)計(jì)有所幫助。

    更多信息請(qǐng)查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:PHP MVC框架skymvc支持多文件上傳
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)