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

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

基于Ajaxupload的多文件上傳操作

熱門標簽:怎樣在地圖標注文字 立陶宛地圖標注 東平縣地圖標注app 電銷機器人 長春 大眾點評400電話怎么申請 上海企業外呼系統價錢 地圖標注推銷坑人 中國地圖標注不明確情況介紹表 河間市地圖標注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> 

總結

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

您可能感興趣的文章:
  • jquery插件ajaxupload實現文件上傳操作
  • 使用jQuery ajaxupload插件實現無刷新上傳文件

標簽:益陽 營口 四川 玉樹 內江 銅川 遼寧 本溪

巨人網絡通訊聲明:本文標題《基于Ajaxupload的多文件上傳操作》,本文關鍵詞  基于,Ajaxupload,的,多,文件,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《基于Ajaxupload的多文件上傳操作》相關的同類信息!
  • 本頁收集關于基于Ajaxupload的多文件上傳操作的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 塔河县| 庆元县| 富阳市| 易门县| 弥渡县| 镇赉县| 共和县| 开远市| 简阳市| 句容市| 岐山县| 同德县| 逊克县| 济宁市| 赣州市| 普格县| 申扎县| 郯城县| 宕昌县| 大石桥市| 四平市| 朝阳区| 黄冈市| 长沙市| 柏乡县| 潮州市| 义乌市| 唐山市| 津南区| 来宾市| 江达县| 新宾| 海门市| 唐河县| 清涧县| 霸州市| 寿阳县| 辽宁省| 邮箱| 繁峙县| 阿克陶县|