怎么在TP5中利用bootstrap實現(xiàn)一個多圖上傳功能-創(chuàng)新互聯(lián)

這篇文章給大家介紹怎么在TP5中利用bootstrap實現(xiàn)一個多圖上傳功能,內(nèi)容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。

創(chuàng)新互聯(lián)為您提適合企業(yè)的網(wǎng)站設(shè)計?讓您的網(wǎng)站在搜索引擎具有高度排名,讓您的網(wǎng)站具備超強的網(wǎng)絡(luò)競爭力!結(jié)合企業(yè)自身,進行網(wǎng)站設(shè)計及把握,最后結(jié)合企業(yè)文化和具體宗旨等,才能創(chuàng)作出一份性化解決方案。從網(wǎng)站策劃到成都網(wǎng)站制作、成都網(wǎng)站設(shè)計, 我們的網(wǎng)頁設(shè)計師為您提供的解決方案。

1----引入js文件和css文件

<!--圖片上傳-->
<link href="/public/static/css/bootstrap.min.css" rel="external nofollow" rel="stylesheet">
<link href="/public/static/css/fileinput.css" rel="external nofollow" media="all" rel="stylesheet" type="text/css" />
<script src="/public/static/js/jquery-2.0.3.min.js"></script>
<script src="/public/static/js/fileinput.js" type="text/javascript"></script>
<script src="/public/static/js/fileinput_locale_de.js" type="text/javascript"></script>
<script src="/public/static/js/bootstrap.min.js" type="text/javascript"></script>

2-html代碼


<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">多圖上傳</label>
<div class="col-sm-10">
<input id="file-0" type="file" multiple class="file" name="path[]" >
</div>
</div>

3-控制器

public function add() {
//多圖上傳
$arryFile = $request->file("path");
foreach ($arryFile as $File){
  $pathImg="";
 //移動文件到框架應(yīng)用更目錄的public/uploads/
  $info = $File->move(ROOT_PATH . 'public' . DS . 'upload' . DS . 'top_bar' . DS . date('Y') . DS . date('m-d'),md5(microtime(true)));
  if ($info) {
   $pathImg = "/public/upload/top_bar/" . date('Y') . '/' . date('m-d') . '/' . $info->getFilename();
  } else {
   //錯誤提示用戶
   return $this->error($File->getError());
  }
  $result["path"] = $pathImg;
  $result["top_bar_id"]=$dataId;
  Db::name('top_path')->insert($result);
 }

關(guān)于怎么在TP5中利用bootstrap實現(xiàn)一個多圖上傳功能就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

分享文章:怎么在TP5中利用bootstrap實現(xiàn)一個多圖上傳功能-創(chuàng)新互聯(lián)
文章位置:http://www.bm7419.com/article48/ihcep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)、網(wǎng)站排名、移動網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計公司、關(guān)鍵詞優(yōu)化、ChatGPT

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化