生活随笔
收集整理的這篇文章主要介紹了
一个简单的ZUI多文件上传的demo和sql练习
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
最近用ZUI做一個上傳文件帶進度條的功能 網上看了很多 ,但是卻實現不了功能 ,自己去使用了ZUI的框架 做了一個小demo 要注意不可以和bootstrap框架同時用 會引起方法變量名沖突. 然后要注意引入zui.js和zui.upload.js.和jquery.js的順序
<!DOCTYPE html>
< html lang = " en" >
< head> < meta charset = " UTF-8" > < title> Title
</ title> < script src = " //cdnjs.cloudflare.com/ajax/libs/zui/1.9.1/lib/jquery/jquery.js" > </ script> < script src = " //cdnjs.cloudflare.com/ajax/libs/zui/1.9.1/js/zui.min.js" > </ script> < link href = " ./../zui/lib/uploader/zui.uploader.css" rel = " stylesheet" > < script src = " ./../zui/lib/uploader/zui.uploader.js" > </ script> < link rel = " stylesheet" href = " //cdnjs.cloudflare.com/ajax/libs/zui/1.9.1/css/zui.min.css" > </ head>
< body>
< div id = " tableUploader" class = " uploader" > < div class = " uploader-message text-center" > < div class = " content" > </ div> < button type = " button" class = " close" > ×
</ button> </ div> < table class = " table table-bordered" > < thead> < tr> < th colspan = " 2" > 文件名
</ th> < th style =" width : 100px" > 大小
</ th> < th style =" width : 160px; text-align : center; " > 狀態/操作
</ th> </ tr> </ thead> < tbody class = " uploader-files" > < tr class = " file template" > < td style =" width : 38px; padding : 3px" > < div class = " file-icon" > </ div> </ td> < td style =" padding : 0" > < div style =" position : relative; padding : 8px; " > < strong class = " file-name" > </ strong> < div class = " file-progress-bar" > </ div> </ div> </ td> < td> < span class = " file-size text-muted" > </ span> </ td> < td class = " actions text-right" style =" padding : 0 4px; " > < div class = " file-status" data-toggle = " tooltip" style =" margin : 8px; " > < i class = " icon" > </ i> < span class = " text" > </ span> </ div> < a data-toggle = " tooltip" class = " btn btn-link btn-download-file" target = " _blank" > < i class = " icon icon-download-alt" > </ i> </ a> < button type = " button" data-toggle = " tooltip" class = " btn btn-link btn-reset-file" title = " Repeat" > < i class = " icon icon-repeat" > </ i> </ button> < button type = " button" data-toggle = " tooltip" class = " btn btn-link btn-rename-file" title = " Rename" > < i class = " icon icon-pencil" > </ i> </ button> < button type = " button" data-toggle = " tooltip" title = " Remove" class = " btn btn-link btn-delete-file" > < i class = " icon icon-trash text-danger" > </ i> </ button> </ td> </ tr> </ tbody> < tfoot> < tr> < td colspan = " 4" style =" padding : 4px 0" > < div style =" position : relative; " > <div class ="uploader-status pull-right text-muted" style="margin-top: 5px;">
</ div> < button type = " button" class = " btn btn-link uploader-btn-browse" > < i class = " icon icon-plus" > </ i> 選擇文件
</ button> < button type = " button" class = " btn btn-link uploader-btn-start" > < i class = " icon icon-cloud-upload" > </ i> 開始上傳
</ button> </ div> </ td> </ tr> </ tfoot> </ table>
</ div>
</ body>
</ html>
< script> $ ( '#tableUploader' ) . uploader ( { url: '../admin/video/uploadvideo' , lang: 'zh_cn' , file_data_name: 'file' , chunk_size: '0' , multipart_params: { foo: 'foo' , bar: [ 'bar1' , 'bar2' ] , test: { attr1: 'attr1 value' } } , responseHandler: function ( responseObject, file) { if ( responseObject. response. indexOf ( 'error' ) ) { return '上傳失敗。服務器返回了一個錯誤:' + responseObject. response; } } } ) ;
</ script>
php端用$_FILES[‘file’]接收即可
$sql = 'SELECT ao.id as o_id,ya.id,ya.areaname FROM y_advertising_order aoLEFT JOIN y_area ya on find_in_set(ya.id,ao.area)where ao.id= :oid ' ; $list = Db
: : query ( $sql , [ 'oid' = > $data ] ) ; ```加一個聯表查詢使用
find_in_set ( ) 的sql
, find_in_set配合join真的很好用
總結
以上是生活随笔 為你收集整理的一个简单的ZUI多文件上传的demo和sql练习 的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔 網站內容還不錯,歡迎將生活随笔 推薦給好友。