废话不多说了,直接给大家贴代码了,具体代码如下所示:
$msg,'filedir'=>$filedir);
sleep(2);
echojson_encode($data);
?>
Ajax上传functionfileupload(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);}})returnfalse;}
添加