zoukankan      html  css  js  c++  java
  • 文件上传">将在3秒钟后返回前页

    conn.php:

    <?php 
    $id=mysql_connect('localhost','root','root');
    mysql_select_db("db_database12",$id);
    mysql_query("set names gb2312");
    ?>

    index.php:

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>限制大小的文件上传</title>
    <style type="text/css">
    <!--
    body {
    	margin-left: 00px;
    	margin-top: 0px;
    	margin-right: 0px;
    	margin-bottom: 0px;
    }
    -->
    </style></head>
    
    <body>
    <table width="385" height="185" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="130" height="75">&nbsp;</td>
        <td width="200">&nbsp;</td>
        <td width="55">&nbsp;</td>
      </tr>
      <form name="form1" method="post" action="index_ok.php" enctype="multipart/form-data">
      <tr>
        <td height="38">&nbsp;</td>
        <td align="center" valign="middle">
        <input name="file3" type="file" id="file3" size="15" maxlength="150">
       </td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="30" align="right">&nbsp;</td>
        <td align="center" valign="top"><input type="submit" name="Submit" value="提交">&nbsp;&nbsp;&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      </form>
      <tr>
        <td height="42">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    </body>
    </html>
    
    

    index_ok.php:

    <?php 
    session_start(); 
    include("conn.php");
    ?>
    <?php
     if($Submit=="提交"){
    $data=date("Y-m-d");
    $file_name="files";
    $filesize=$_FILES['file3']['size'];
    if($filesize>2000000){
    echo "对不起,您上传的文件超过了规定的大小!!";2881064151
    echo "<meta http-equiv="Refresh" content="3;url=index.php?lmbs=文件上传">将在3秒钟后返回前页...";
    }else{
    $path = './upfiles/'. $_FILES['file3']['name'];
    if (move_uploaded_file($_FILES['file3']['tmp_name'],$path)) { 
    	$query="insert into tb_file2(file_name,file_text,data)values('$file_name','$path','$data')";
    	$result=mysql_query($query);
    	if($result=true){ 
    	echo "上传成功!!";
    	echo "<meta http-equiv="Refresh" content="3;url=index.php?lmbs=文件上传">"; 
    	}else{echo "文件上传失败!!";
              echo "<meta http-equiv="Refresh" content="3;url=index.php?lmbs=文件上传">";}
    }}}
    ?>
  • 相关阅读:
    开发win8 metro monogame,显示pubcenter广告时会使游戏卡住的问题的解决方法。
    win8商店应用验证,二进制文件是在调试模式下生成的解决方案。
    slxna,游戏页面切到后台回来后返回sl页面导致sl页面无响应,解决方法。
    支持虚拟化也开来虚拟化就是装不上HyperV的解决方法
    WP中一些耗时的东西
    WP自定义字体
    SystemTray文字颜色问题
    longlistselector 闪烁问题研究
    vs2013安装xna4.0模板
    让textbox紧贴IME
  • 原文地址:https://www.cnblogs.com/cbryge/p/6011166.html
Copyright © 2011-2022 走看看