标签:video sub http eth 提交 rom 文件上传 php attr
主页面:
<script src="../fzl/jquery-1.11.2.min.js"></script> <script src="../tanchuang/tanchuang.js"></script> <script src="fenye.js"></script> <title>无标题文档</title> <style type="text/css"> *{ margin:0px auto; padding:0px} #file{ width:200px; height:200px; opacity:0} #file1{ width:200px; height:200px; opacity:0} #btn{ width:200px; height:30px; font-size:24px} #pic{ display:none} #hidden_frame{ display:none} #a6{ width:200px; height:200px; background-image:url(chu/img/car.png); background-size:200px 200px} #a7{ width:200px; height:200px; background-image:url(chu/img/car.png); background-size:200px 200px} </style> <?php include("../fzl/czy.class.php"); $db = new czy(); ?> </head> <body> <form action="spxiazai.php" method="post" enctype="multipart/form-data" id="sc" target="hidden_frame"> <div id="a"> <div id="a1"> <span>商品类型:</span> <select id="leixing" name="leixing" style="height:25px; width:100px" > <?php $sql = "select * from leibie "; $attr = $db->Query($sql); foreach($attr as $v) { echo "<option value=‘{$v[0]}‘>{$v[1]}</option>"; } ?> </select> </div><!--a1--> <div id="a2"> <span>商品名称:</span><input type="text" name="name" style="height:25px" /> </div><!--a2--> <div id="a3"> <span>观看价格:</span><input type="text" name="guankan" style="height:25px" /> </div><!--a3--> <div id="a4"> <span>下载价格:</span><input type="text" name="xiazai" style="height:25px" /> </div><!--a4--> <div id="a5"> <span style="float:left">下载价格:</span><textarea id="xq" style="height:50px; width:200px"></textarea> </div><!--a5--> <div id="a6"> <span style="float:left">图片路径:</span> <input type="file" name="file" id="file" onchange="document.getElementById(‘sc‘).submit()" /> <img id="pic" /> </div><!--a6--> </div><!--a--> </form> <iframe name="hidden_frame" id="hidden_frame"></iframe> <form action="shipinxiazai.php" method="post" enctype="multipart/form-data"> <div id="a7"> <span style="float:left">视频路径:</span><input type="file" name="file1" id="file1" /> </div><!--a6--> <input type="submit" value="提交" id="btn" /> </form> </body>
图片+信息上传处理页面:
<?php include("../fzl/czy.class.php"); $db = new czy(); //上传文件限制 $t = date("ymdHis"); if ((($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/jpeg")|| ($_FILES["file"]["type"] == "image/png"))&& ($_FILES["file"]["size"] < 10000000)) { //文件上传是否出错 if ($_FILES["file"]["error"] > 0) { echo "上传出错: " . $_FILES["file"]["error"] . "<br />"; } else { //判断文件是否已存在 $filename = "./ru/pic/".$t.$_FILES["file"]["name"];//php的路径 $filename = iconv("UTF-8","gb2312",$filename); if (file_exists($filename)) { echo "<script language=‘javascript‘>alert(‘文件已经存在!‘)</script>"; } else { //移动图片至保存路径,解决中文乱码问题 move_uploaded_file($_FILES["file"]["tmp_name"],$filename); echo "<script language=‘javascript‘>parent.showimg(‘"."ru/pic/".$t.$_FILES["file"]["name"]."‘)</script>";//js路径,要返回页面不能直接用php路径,要拼接此路径 } } } else { echo "上传失败"; }
视频上传处理页面:
<?php include("../fzl/czy.class.php"); $db = new czy(); //上传文件限制 $t = date("ymdHis"); if (($_FILES["file1"]["type"] == "video/avi") && ($_FILES["file1"]["size"] < 100000000)) { //文件上传是否出错 if ($_FILES["file1"]["error"] > 0) { echo "上传出错: " . $_FILES["file1"]["error"] . "<br />"; } else { //判断文件是否已存在 $filename = "./ru/video/".$t.$_FILES["file1"]["name"];//php的路径 $filename = iconv("UTF-8","gb2312",$filename);//echo $filename; if (file_exists($filename)) { echo "<script language=‘javascript‘>alert(‘文件已经存在!‘)</script>"; } else { //移动图片至保存路径,解决中文乱码问题 move_uploaded_file($_FILES["file1"]["tmp_name"],$filename); } } } else { echo "上传失败"; }
标签:video sub http eth 提交 rom 文件上传 php attr
原文地址:http://www.cnblogs.com/cuizhenyu/p/6127793.html