使用uploadify插件怎么實(shí)現(xiàn)多圖上傳?針對這個(gè)問題,這篇文章詳細(xì)介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡單易行的方法。
創(chuàng)新互聯(lián)建站長期為成百上千家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為大峪企業(yè)提供專業(yè)的網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作,大峪網(wǎng)站改版等技術(shù)服務(wù)。擁有十余年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。
json數(shù)據(jù)格式如下:
頁面代碼如下:
注:需要引用jQuery.js、uploadify.js、uploadify文件。。uploadify文件下載地址
<html> <head> <script type="text/javascript" src="static/js/jquery.js">"></script> <script type="text/javascript" src="static/js/jquery.select.js">"></script> </head> <body> <div class="file-box"> <div id="divPreview"> <span >(最多可上傳五張圖片)</span> </div> <input type="file" name="file" class="file" id="fileField" /> <input type="hidden" name="hash" id="hash" value="xoxo"/> </div> <script> $(function() { $("#fileField").uploadify({ 'height' : 30, 'swf' : '<?php echoYii::app()->request->baseUrl ?>/static/uploadify/uploadify.swf?var='+(newDate()).getTime(), 'uploader' :'index.php?r=upload/uploadimage', 'width' : 120, 'onUploadSuccess' : function(file, data, response) { var info = eval("("+data+")"); if(info.err==1){alert(info.msg);} //如果圖片過大或者格式錯(cuò)誤彈出錯(cuò)誤信息 else{ $("#divPreview").append($("<img src='" + info.img + "'/>")); $("#divPreview").append($("<input type='hidden' name='imgId[]' value='" + info.imgId + "'/>")); } }, 'buttonText' : '瀏覽文件', 'uploadLimit' : 5, //上傳最多圖片張數(shù) 'removeTimeout' : 1, 'preventCaching': true, //不允許緩存 'fileSizeLimit' : 4100, //文件最大 'formData' : { '<?php echosession_name();?>' : '<?php echosession_id();?>','hash':$("#hash").val() } //hash }); $("#SWFUpload_0").css({ //設(shè)置按鈕樣式,根據(jù)插件文檔進(jìn)行修改 'position' :'absolute', 'top': 20, 'left': 35, 'z-index' : 1 }); }); </script> </body> </html>
關(guān)于使用uploadify插件怎么實(shí)現(xiàn)多圖上傳問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識(shí)。
分享標(biāo)題:使用uploadify插件怎么實(shí)現(xiàn)多圖上傳
當(dāng)前地址:http://chinadenli.net/article30/ppjcso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、服務(wù)器托管、網(wǎng)站制作、靜態(tài)網(wǎng)站、企業(yè)網(wǎng)站制作、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)