近期扩展一个网站上传图片功能,用的是uploadify 控件来实现的。
现在代码写到一半,上传图片100%后却没有出现下一步,以下是代码:<?php 
if ( file_exists( BasePath . "/js/validate/member_shoptag.add.html" ) ) {
include_once( BasePath . "/js/validate/member_shoptag.add.html" );
}
?> ...........
<tr>
<td class="cr-11"><?php echo $lang['langUploadPic'];?>:</td>
<td class="cr-2" colspan="3">
<div class="up-img"><ul>
<?php if(!empty($output['pic_array']) && is_array($output['pic_array'])){ ?>
                                
<?php foreach($output['pic_array'] as $k => $v){ ?>
<li><div class="box-2"><img src="<?php echo SITE_URL;?>/<?php echo $v['small_pic'];?>" style="width:105px; height:80px" /></div><p><a name="<?php echo $v['p_pic'];?>" class="a-1" href="javascript:;" onclick="CopyToClipboard('<?php echo SITE_URL;?>/<?php echo $v['p_pic'];?>');"><?php echo $lang['langPIntoEditor']; ?></a><a class="a-2" href='javascript:;' onclick=ajaxFileDel("<?php echo $v['small_pic'];?>",this);><?php echo $lang['langbtnProductDel'];?></a></p></li>
<?php } ?>
                                
                               
<?php } ?>
</ul>
 </div>
                                <div class="clear-5"></div>
<input type="file" name="uploadify" id="uploadify" />
<div id="fileQueue"></div>
<input type="hidden" value="" name="pichidden" id="pichidden" />
<a class="a-3" href="javascript:$('#uploadify').uploadifyUpload()"><?php echo $lang['langSgartUploadPic']; ?></a>
<div id="div_pic_upload" style=" padding-top:3px;"></div>
<span class="cr-5-span"><?php echo $lang['langProductPicSize'];?></span>
</td>
</tr>
<script>
var num=0;
function pic_add_tr(){
// 如果图片数量超过3 则返回信息,不允许添加
if($("#pic_num").val() > 4){
alert("<?php echo $lang['langPPicNumOne'];?>5<?php echo $lang['langPPicNumTwo'];?>");
return false;
}
$('#div_pic_upload').append('<input type=\'file\' name=\'txtPpic_'+num+'\' /><br />');
num++;
// 图片数量+1
$("#pic_num").val(parseInt($("#pic_num").val())+1);
}
</script>
<tr id="td_tagcontent" <?php if ( $output['tag_array']['tag_url'] != '' ) { ?> style="display:none;" <?php } ?> >
<td class="cr-1"><?php echo $lang['langShopTagContent']; ?>:</td>
<td class="cr-2">
<?php
include_once('../classes/resource/editor/editor.class.php');
$editor=new editor('txtTagcontent');
$editor->Value=$output['tag_array']['tag_content'];
$editor->BasePath='../classes/resource/editor';
$editor->Height=460;
$editor->Width=621;
$editor->AutoSave=false;
$editor->Create();
?>
<label style="display:none" id="errTagcontent" class="wrong"></label> 
</td>
</tr>
...............
<link type="text/css"  href="<?php echo TPL_DIR;?>/css/uploadify.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="http://www.zxnsy.com/templates/member/css/reset-fonts-grids.css">
<script type="text/javascript" src="../js/uploadify/swfobject.js"></script>
<script type="text/javascript" src="../js/uploadify/jquery.uploadify.v2.1.0.min.js"></script>
<script>function updatapic()
{
$("#p_pic").val($(".up-img").children("ul").children("li:first").children("p").children("a:first").attr('name'));
}function CopyToClipboard(imgpath)
{
var editor = window.frames['editor_iframe'].EDiaryEditor;
var oRTE = editor.iframe.contentWindow;
alert
var html = "<img src='" + imgpath + "'>";
if(window.isIE) {
try{
oRTE.focus();
var oRng = oRTE.document.selection.createRange();
oRng.pasteHTML(html);
oRng.collapse(false);
oRng.select();
}
catch(e){}
}
else {
oRTE.focus();
oRTE.document.execCommand('InsertImage', false, imgpath);
oRTE.focus();
}


  /* if(window.clipboardData) {        
              window.clipboardData.clearData();        
              window.clipboardData.setData("Text", txt);        
      } else if(navigator.userAgent.indexOf("Opera") != -1) {        
           window.location = txt;        
      } else if (window.netscape) {        
          try {        
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");        
           } catch (e) {
                alert("<?php echo $lang['errPCopyFail'];?>");
           }        
          var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);        
          if (!clip)        
               return;        
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);        
          if (!trans)        
              return;        
           trans.addDataFlavor('text/unicode');        
          var str = new Object();        
          var len = new Object();        
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);        
          var copytext = txt;        
           str.data = copytext;        
           trans.setTransferData("text/unicode",str,copytext.length*2);        
          var clipid = Components.interfaces.nsIClipboard;        
          if (!clip)        
               return false;        
           clip.setData(trans,null,clipid.kGlobalClipboard);        
           alert("<?php echo $lang['langPCopySucc'];?>")        
      }*/        
}function upfile()
{
jQuery('#uploadify').uploadifyUpload();
}
var picobj="";
$().ready(function (){
$("#tag_type1").click(function () {
$("#td_tagurl").hide();
$("#td_tagcontent").show();
});
$("#tag_type2").click(function () {
$("#td_tagurl").show();
$("#td_tagcontent").hide();
});

$("#uploadify").uploadify({
'uploader'       : '../js/uploadify/uploadify.swf',
'script'         : 'own_shoptag.add.php?action=pic_ajax&PHPSESSID=<?php echo $output['PHPSESSID'];?>',
'scriptData'  :{'action':'pic_ajax','PHPSESSID':'<?php echo $output['PHPSESSID'];?>'},
'fileDataName'   : 'fileData',
'cancelImg'      : 'cancel.png',
'folder'         : '../uploads',
'queueID'        : 'fileQueue',
'auto'           : false,
'multi'          : true,
'sizeLimit'      : <?php echo $output['upload_max_size']*1000;?>,
'buttonText'  : "select",
'fileDesc'       : '<?php echo $lang['langPSupportFormat'];?>:<?php echo $output['upload_type'];?>', 
     'fileExt'        : '<?php echo $output['upload_ext'];?>',
'queueSizeLimit' : 5-$(".up-img").children("ul").children("li").length,
'buttonImg'      : '<?php echo TPL_DIR;?>/images/zengjia.gif',
'cancelImg'      : '<?php echo TPL_DIR;?>/images/cancel.png',
'onComplete'     : function(e,queueId,fileObj,data){
datas=data.split(".");
$(".up-img").children("ul").append('<li><div class="box-2"><input type="hidden" value="'+data+'"><img src="<?php echo SITE_URL;?>/'+datas[0]+'_small.'+datas[1]+'" style="width:105px; height:80px" /></div><p><a class="a-1" name="'+data+'" href="javascript:;" onclick="CopyToClipboard(\'<?php echo SITE_URL;?>/'+data+'\');"><?php echo $lang['langPIntoEditor'];?></a><a class="a-2" href="javascript:;" onclick=\'ajaxFileDel("'+datas[0]+'_small.'+datas[1]+'",this);\'><?php echo $lang['langbtnProductDel'];?></a></p></li>');
$('#uploadify').uploadifySettings('queueSizeLimit',5-$(".up-img").children("ul").children("li").length);
},
'onQueueFull' : function(e,q){
alert("<?php echo $lang['langPPicNumOne'];?>5<?php echo $lang['langPPicNumTwo'];?>");
return false;
},
'onAllComplete':function(){
picobj="";
$.each($(".up-img").children("ul").children("li").children("div").children("input"),function(){
picobj+=$(this).val()+"|||";
});
$("#pichidden").val(picobj);
},
'onError':function(event,id,fileObj,errorObj){

alert("唯一标识:" + queueId + "\r\n" + 
                  "文件名:" + fileObj.name + "\r\n" + 
                  "文件大小:" + fileObj.size + "\r\n" + 
                  "创建时间:" + fileObj.sizeLimit + "\r\n" + 
                  "文件类型:" + fileObj.type 
            ); 
if(errorObj.type=="File Size")
{
$("#uploadify"+id).children(".percentage").html("<?php echo $lang['errPFileSizeNotBeyond'];?><?php echo $output['upload_max_size'];?>KB");
$("#uploadify"+id).attr("class","uploadifyQueueItem uploadifyError");
return false;
}
}
})
});
function accDiv(arg1,arg2){
var t1=0,t2=0,r1,r2;
try{t1=arg1.toString().split(".")[1].length}catch(e){}
try{t2=arg2.toString().split(".")[1].length}catch(e){}
with(Math){
r1=Number(arg1.toString().replace(".",""));
r2=Number(arg2.toString().replace(".",""));
return (r1/r2)*pow(10,t2-t1);
}
}
// 删除图片 缩略图名称
function ajaxFileDel(pic_url,obj){
$.ajax({
url: "own_product.php",
data: 'action=pic_del&pic_name='+pic_url,
type:'post',
dataType:"json",
success: function(msg){
if(msg.type == '0'){
alert(msg.message);
}else{
$(obj).parents("li").remove();
/*arr = $('#p_pic').val().split('|');
for(i=0;i<arr.length;i++){
if(arr[i] == pic_url){
delete(arr[i]);
}
}
$('#p_pic').val(arr.join('|'));*/
// 图片数量-1
$('#uploadify').uploadifySettings('queueSizeLimit',(5-$(".up-img").children("ul").children("li").length));
$("#pic_num").val(parseInt($("#pic_num").val())-1);
}
}
});
return false;
}</script>求解!