用php代码编写上传flash的文件
展开全部
<form action="Within_right.php" method="post" ENCTYPE="multipart/form-data">
<table border="1">
<tr><td>图片标题:<input type="text" name="title" ></td><td>选择图片:<input type="file" name="myfile" ></td></tr>
<input type="hidden" name="pid" value="<?php echo $_GET['pid']?>">
<tr><td align="center" colspan="2"><input type="submit" value="确定上传" ><input type="reset" value="取消" ></td></tr>
</table>
</form>
if($_SERVER["REQUEST_METHOD"]=="POST"){
//生成随机文件名
$file=$_FILES['myfile']['tmp_name'];
$filename=$_FILES['myfile']['name'];
//本地存储文件名
$filetype="E:/PHPnow-1.5.4/PHPnow-1.5.4/htdocs/phonelist/images/phonepic_list/".$filename;
//把上传到服务器上的临时文件copy到网站目录下
//图片文件URL
$relfile="images/phonepic_list/".$filename;
if(!empty($_POST['title'])&©($file,$filetype)&&$_SESSION['userid'])
{
$guanlianselect="select title from guanlian where title='".$_POST['title']."'";
$titleresult=GetMap($guanlianselect);
if(empty($titleresult)){
$guanliansql="insert into guanlian (pid,title) values ('".$_POST['pid']."','".$_POST['title']."')";
$guanlianresult=Query($guanliansql);
if($guanlianresult)
{
$selectsql="select id from guanlian where title='".$_POST['title']."'";#取出guanlian表中插入相应标题的id
$contentid=GetMap($selectsql);
$contentsql="insert into content (id,pic,uid,addtime) values ('".$contentid[0]['id']."','".$relfile."','".$_SESSION['userid']."','".time()."')";
$conresult=Query($contentsql);
}
if(!$guanlianresult&&!$conresult)
{
echo "<script language='javascript'>alert('操作失败!');</script>";
}else
{
echo "<script language='javascript'>alert('操作成功!'); window.open('admin.php');window.parent.opener=null;window.parent.close();</script>";
}
}else{
echo "<script language='javascript'>alert('提交标题重复!');</script>";
}
}
}
<table border="1">
<tr><td>图片标题:<input type="text" name="title" ></td><td>选择图片:<input type="file" name="myfile" ></td></tr>
<input type="hidden" name="pid" value="<?php echo $_GET['pid']?>">
<tr><td align="center" colspan="2"><input type="submit" value="确定上传" ><input type="reset" value="取消" ></td></tr>
</table>
</form>
if($_SERVER["REQUEST_METHOD"]=="POST"){
//生成随机文件名
$file=$_FILES['myfile']['tmp_name'];
$filename=$_FILES['myfile']['name'];
//本地存储文件名
$filetype="E:/PHPnow-1.5.4/PHPnow-1.5.4/htdocs/phonelist/images/phonepic_list/".$filename;
//把上传到服务器上的临时文件copy到网站目录下
//图片文件URL
$relfile="images/phonepic_list/".$filename;
if(!empty($_POST['title'])&©($file,$filetype)&&$_SESSION['userid'])
{
$guanlianselect="select title from guanlian where title='".$_POST['title']."'";
$titleresult=GetMap($guanlianselect);
if(empty($titleresult)){
$guanliansql="insert into guanlian (pid,title) values ('".$_POST['pid']."','".$_POST['title']."')";
$guanlianresult=Query($guanliansql);
if($guanlianresult)
{
$selectsql="select id from guanlian where title='".$_POST['title']."'";#取出guanlian表中插入相应标题的id
$contentid=GetMap($selectsql);
$contentsql="insert into content (id,pic,uid,addtime) values ('".$contentid[0]['id']."','".$relfile."','".$_SESSION['userid']."','".time()."')";
$conresult=Query($contentsql);
}
if(!$guanlianresult&&!$conresult)
{
echo "<script language='javascript'>alert('操作失败!');</script>";
}else
{
echo "<script language='javascript'>alert('操作成功!'); window.open('admin.php');window.parent.opener=null;window.parent.close();</script>";
}
}else{
echo "<script language='javascript'>alert('提交标题重复!');</script>";
}
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询