婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 基于Ajaxupload的多文件上傳操作

基于Ajaxupload的多文件上傳操作

熱門標(biāo)簽:怎樣在地圖標(biāo)注文字 立陶宛地圖標(biāo)注 東平縣地圖標(biāo)注app 電銷機(jī)器人 長春 大眾點(diǎn)評400電話怎么申請 上海企業(yè)外呼系統(tǒng)價錢 地圖標(biāo)注推銷坑人 中國地圖標(biāo)注不明確情況介紹表 河間市地圖標(biāo)注app

廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:

pre name="code" class="php">?php 
$ele = $_GET['ele']; 
$file = $_FILES['thumb_'.$ele]; 
$pathinfo = pathinfo($file['name']); 
$filedir = 'uploads/' . date('Y'); 
if (!is_dir($filedir)) 
{ 
  mkdir($filedir); 
} 
$filedir .= '/' . date('md'); 
if (!is_dir($filedir)) 
{ 
  mkdir($filedir); 
} 
$filedir .= '/' . time() . '_' . mt_rand(1000, 9999) . '.' . $pathinfo['extension']; 
$msg = ''; 
if (!move_uploaded_file($file['tmp_name'], $filedir)) 
{ 
  $msg = '上傳失敗'; 
} 
$data = array('msg' => $msg, 'filedir' => $filedir); 
sleep(2); 
echo json_encode($data); 
?>/pre>br> 
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">html xmlns="http://www.w3.org/1999/xhtml">head>meta http-equiv="Content-Type" content="text/html; charset=gbk" />title>Ajax上傳/title>script 
 src="jquery-1.4.4.min.js" type="text/javascript">/script>script src="ajaxfileupload.js" type="text/javascript">/script>script type="text/javascript">function fileupload( ele ){$("#loading").ajaxStart(function() {jQuery("#photoImg").hide();jQuery(this).show();}).ajaxComplete(function() 
 {jQuery(this).hide();jQuery("#photoImg").show();});$.ajaxFileUpload({url: "index.php?ele="+ele,secureuri: false,fileElementId: "thumb_"+ele,dataType: "json",success: function(data, status) {if(data.msg != '') {alert(data.msg);}else {$("[name='photo_"+ele+"']").val(data.filedir);$("#photoImg_"+ele).attr("src", 
 data.filedir);}},error: function (data, status, e) {alert(e);}})return false;}/script>/head>body>!-- 第一個ajax上傳 -->input type="file" id="thumb_1" name="thumb_1" onchange="return fileupload('1');" />div>img src="ajaxLoading.gif" id="loading" style="display: 
 none" />img src="" id="photoImg_1" width="200px" height="150px" />input type="text" name="photo_1" size=100/>/div>hr/>!-- 第二個ajax上傳 -->input type="file" id="thumb_2" name="thumb_2" onchange="return fileupload('2');" />div>img src="ajaxLoading.gif" 
 id="loading" style="display: none" />img src="" id="photoImg_2" width="200px" height="150px" />input type="text" name="photo_2" size=100 />/div>!-- 第二個ajax上傳 -->input type="file" id="thumb_2" name="thumb_2" onchange="return fileupload('2');" />div>img 
 src="ajaxLoading.gif" id="loading" style="display: none" />img src="" id="photoImg_2" width="200px" height="150px" />input type="text" name="photo_2" size=100 />/div>a>添加/a>/body>/html> 
pre>/pre> 
p>br> 
/p> 
p>br> 
/p> 
p>br> 
/p> 
br> 

總結(jié)

以上所述是小編給大家介紹的基于Ajaxupload的多文件上傳操作,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

您可能感興趣的文章:
  • jquery插件ajaxupload實(shí)現(xiàn)文件上傳操作
  • 使用jQuery ajaxupload插件實(shí)現(xiàn)無刷新上傳文件

標(biāo)簽:益陽 營口 四川 玉樹 內(nèi)江 銅川 遼寧 本溪

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《基于Ajaxupload的多文件上傳操作》,本文關(guān)鍵詞  基于,Ajaxupload,的,多,文件,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《基于Ajaxupload的多文件上傳操作》相關(guān)的同類信息!
  • 本頁收集關(guān)于基于Ajaxupload的多文件上傳操作的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 平阴县| 达拉特旗| 错那县| 额济纳旗| 浑源县| 根河市| 淮南市| 桂平市| 通河县| 乾安县| 石阡县| 随州市| 博野县| 孟村| 蕲春县| 嵊州市| 罗定市| 凌云县| 江华| 裕民县| 武乡县| 绩溪县| 盐亭县| 墨玉县| 曲沃县| 台东县| 平山县| 科技| 南汇区| 大英县| 义乌市| 广东省| 宁远县| 疏附县| 句容市| 大竹县| 镇巴县| 双城市| 栖霞市| 阳新县| 西平县|