好像config里面可以设置 你搜索搜索

解决方案 »

  1.   

    在web.config中添加httpRuntime元素,如下:
    <configuration>
       <system.web>
          <httpRuntime maxRequestLength="8192"
             useFullyQualifiedRedirectUrl="true"
             executionTimeout="45"
             versionHeader="1.1.4128"/>
       </system.web>
    </configuration>
      

  2.   

    upload.php  文件代码是
    <? include 'const.php';?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <link href="edit.css" rel="stylesheet" type="text/css" />
    </head>
    <body><form  name="myform" action="upload1.php" enctype="multipart/form-data" method="post" target="_self">
    <table width="600" border="0">
      <tr>
        <td colspan="2"><div align="center">图片上传</div></td>
      </tr>
      <tr>
        <td width="30%" align="right" valign="top">选择被上传的图片:</td>
        <td width="453"><input type="hidden" name="MAX_FILE_SIZE" value= $max_size>
    <input  type="file"  name="upload" size="29"></td>
      </tr>
    </table>
    <p align="center">(文件小于<?php echo $max_size;?>字节才能上传)</p>
    <label>
          <input type="submit" name="Submit" value="提交" />
        </label>
          <label>
          <input type="reset" name="Submit2" value="重置" />
        </label>
    </form>
    </body>
    </html>upload1.php代码是<?php
    $TimeLimit=  36000;
      set_time_limit($TimeLimit);
    function getname($exname){
       $dirnam = "files/";
       $i=date("YmdHis");   
       while(true){
           if(!is_file($dirnam.$i.".".$exname)){
           $name=$i.".".$exname;
           break;
       }
       
     }
    // echo $dirnam.$name;   return $name;
    }  $max_size = 1000000000;
      $location = "files/";
      $suo = "files/";
         $event = "上传成功";
      if(!$_FILES['upload']['name'] == "")
      {
        if($_FILES['upload']['size']< $max_size) 
    {
    $exname=strtolower(substr($_FILES['upload']['name'],(strrpos($_FILES['upload']['name'],'.')+1)));
    //显示上传文件的后缀名
    if (($exname =="jpg") or ($exname =="txt") or ($exname =="doc") or ($exname =="pdf") or($exname =="xls"))
    {$uploadfile = getname($exname);
      echo "文件上传名: ".$uploadfile;
     
      move_uploaded_file($_FILES['upload']['tmp_name'],$location.$uploadfile) ;
     
        
           
             include 'const.php';
      $sql = "INSERT INTO `anli` ( `id` ,`image` ) VALUES (NULL , '$uploadfile')";
      $result = mysql_query($sql);
      mysql_close();
         }
    else{
    $event = "文件格式不对";
    }

    }else{
      $event = "文件太大";
          }  
        }else{$event = "失败,无上传图片";}
      echo $event;
      
      
         
      ?>
    <p>[<a href="upload.php">上载更多文件</a>]</p>
    用了这个函数set_time_limit($TimeLimit);
    不管用还是出现
    Fatal error: Maximum execution time of 30 seconds exceeded in c:\program files\siteengine\siteenginephp\www\nei\admin\wenjian\upload1.php on line 2
    这个错误
      

  3.   

    打开php.ini  查找  max_execution_time = 30(单位是秒)  默认是30秒把时间设置大一点就可以了,不过不是很推荐这种做法!