打开的这个流关不掉!
你把/tmp_img下的图片删除之后,或者新上传图片之后,这个流还是旧的流,内容就没有变。
这是完整代码:
<?
include("config.php");
if($file_name!=""){
$flag=false;
switch($file_type){
case "image/gif":
$value=".gif";
$flag=true;
break;
case "image/pjpeg":
$value=".jpg";
$flag=true;
break;
}
if($flag){
if(copy($file,"tmp_img/".$file_name)){echo "<script>alert('上传成功')</script>";}
else{echo "<script>alert('上传失败')</script>";}
}
else{echo "<script>alert('请上传JPG、GIF、SWF类型文件')</script>";}
}?>
<html>
<head>
<title>图片</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="STYLESHEET" type="text/css" href="edit.css">
<script>
function insertimg(){
var string = showModalDialog("sel-img.php","","dialogWidth:20em;dialogHeight:22em;center:yes;help:no;resizable:no;status:no;scroll:yes;"); if(string!=null){
var ss;
ss="<img src='" + string + "'>";
content=parent.Composition.document.body.innerHTML;
content=content+ss;
parent.Composition.document.body.innerHTML=content;
}
}
</script>
</head>
<body bgcolor="#CCCCCC">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form action="" method="post" enctype="multipart/form-data" name="upimg">
<tr>
<td>图片
<input name="file" type="file" class="heading" size="10">
<input type="submit" name="Submit" value="上传" class="heading0">
<input name="btn" type="button" id="btn2" value="插图" class="heading0" onClick="insertimg()"></td>
</tr>
</form>
</table>
</body>
</html>
<?@mysql_close();?>
你把/tmp_img下的图片删除之后,或者新上传图片之后,这个流还是旧的流,内容就没有变。
这是完整代码:
<?
include("config.php");
if($file_name!=""){
$flag=false;
switch($file_type){
case "image/gif":
$value=".gif";
$flag=true;
break;
case "image/pjpeg":
$value=".jpg";
$flag=true;
break;
}
if($flag){
if(copy($file,"tmp_img/".$file_name)){echo "<script>alert('上传成功')</script>";}
else{echo "<script>alert('上传失败')</script>";}
}
else{echo "<script>alert('请上传JPG、GIF、SWF类型文件')</script>";}
}?>
<html>
<head>
<title>图片</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="STYLESHEET" type="text/css" href="edit.css">
<script>
function insertimg(){
var string = showModalDialog("sel-img.php","","dialogWidth:20em;dialogHeight:22em;center:yes;help:no;resizable:no;status:no;scroll:yes;"); if(string!=null){
var ss;
ss="<img src='" + string + "'>";
content=parent.Composition.document.body.innerHTML;
content=content+ss;
parent.Composition.document.body.innerHTML=content;
}
}
</script>
</head>
<body bgcolor="#CCCCCC">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form action="" method="post" enctype="multipart/form-data" name="upimg">
<tr>
<td>图片
<input name="file" type="file" class="heading" size="10">
<input type="submit" name="Submit" value="上传" class="heading0">
<input name="btn" type="button" id="btn2" value="插图" class="heading0" onClick="insertimg()"></td>
</tr>
</form>
</table>
</body>
</html>
<?@mysql_close();?>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货