<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<?php 
if(!empty($_GET[submit])) { 
$path="images/ywsimg/";
if(!file_exists($path))  { 
mkdir("$path", 0700);  }
$tp = array("image/gif","image/pjpeg","image/png"); 
if(!in_array($_FILES["filename"]["type"],$tp))  { 
echo "图片类型错误"; 
exit; 
}
if($_FILES["filename"]["name"])  { 
$file1=$_FILES["filename"]["name"]; 
$file2 = $path.time().$file1; 
$flag=1;  }
if($flag)
$result=move_uploaded_file($_FILES["filename"]["tmp_name"],$file2);   
if($result)  { 
echo "<script language='javascript'>"; 
echo "alert(\"上传成功\");";   
echo "</script>"; 
echo("<input type=\"button\" name=\"Submit\" value=\"确定\" onClick=\"window.opener.setFile('".time().$file1."');window.close();\">");
echo "图片名称:".time().$file1; } } else {
echo "file is null!";
}
?>
在这里上传成功后提示“上传成功”并跳转到addyaowen.php这个页面
上传失败的在提示“上传失败”并返回当前页面
希望能给解决  , 拜谢了

解决方案 »

  1.   

    成功
    header('location:addyaowen.php');
    失败
    echo '<script>history.go(-1);</script>';
      

  2.   

    echo "<script language='javascript'>";
    echo "location='addyaowen.php';";
    echo "</script>";<a href=javascript:history.back();>&lt;&lt; 返回</a>
      

  3.   

    http://www.langsin.com/index.html?ID=30可以在这看看视频
      

  4.   

    他出现这个错误;Parse error: syntax error, unexpected $end in C:\AppServ\www\CMS\admin\link_upload.php on line 27
      

  5.   

    出现这个错:Parse error: syntax error, unexpected $end in C:\AppServ\www\CMS\admin\link_upload.php on line 27