I haven't see any input named "pic" in your code.
and you are posting files,you should use up_load_file.

解决方案 »

  1.   

    <?php
       $face=$_FILE['pic'];
     
      $zazhi=$_FILE['zazhi'];
      echo $face;
      echo $zazhi;
    ?>
      

  2.   

    下面是我的源程序大家看一下哦!!!为什么总是出现“填写内容不能为空!”
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>杂志上传</title>
    <style type="text/css">
    <!--
    body {
    background-image: url(image/9.gif);
    }
    .ds {
    font-size: 12px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    font-variant: normal;
    color: #77A9E0;
    text-decoration: none;
    }
    -->
    </style></head><body>
    <form action="upload_code.php" method="post" enctype="multipart/form-data" name="form1">
      <table width="498" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E9F2FF">
        <tr class="ds" background="image/12.gif">
          <td colspan="3"><div align="center">杂志上传</div></td>
        </tr>
        <tr class="ds">
          <td width="101"><div align="right">杂志名称:</div></td>
          <td colspan="2"><input name="name" type="text" id="name" size="50"></td>
        </tr>
        <tr class="ds">
          <td><div align="right">杂志封面:</div></td>
          <td colspan="2"><input name="face" type="file" id="face" size="30"></td>
        </tr>
        <tr class="ds">
          <td align="right" valign="middle">上传杂志:</td>
          <td colspan="2"><label>
            <input name="zazhi" type="file" id="zazhi" size="30">
          </label></td>
        </tr>
        <tr class="ds">
          <td align="right" valign="top"><div align="right">杂志描述:</div>
              <div align="left"></div></td>
          <td colspan="2" align="left" valign="top"><textarea name="description" cols="50" rows="7" id="description"></textarea></td>
        </tr>
        <tr class="ds">
          <td align="right" valign="top"><div align="center">
          </div></td>
          <td width="273" align="right" valign="top"><div align="center">
              <input name="submit" type="submit" id="submit" value="上传">
              <input type="reset" name="Submit" value="重置">
          </div></td>
          <td width="56" align="center" valign="middle"><a href="/radio/news/logout.php" class="ds">退出管理</a></td>
        </tr>
      </table>
    </form>
    </body>
    </html>
    另一个页面<?php
    /*$username=$_COOKIE['username'];
    if(!$username)
    {
    echo'<script>alert("你还没有登陆!");</script>';
      echo "<meta http-equiv=\"refresh\" content=\"2;url=index.php\">";
      exit;
    }
    $username = $_COOKIE["username"];
    $passwd = $_COOKIE["passwd"];
    if(empty($username)||empty($passwd))
    {
    echo "<script language=\"javascript\">alert(\"请你先登陆。\");</script>";
    echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";
    exit();
    }*/
    ?>
    <?php
     $name=$_POST['name'];
     $face=$_POST['pic'];
     $zazhi=$_POST['zazhi'];
     $description=$_POST['description'];
     //echo $zazhi;exit;
     /*$hot=$_POST['hot'];
     $type=$_POST['type'];
     $time=date("Y-m-d H:i:s");*/
     $time1=date(Ymdhis); 
     //echo $message;exit;
     if($name==""||$zazhi==""||$description=="") 
      {
       echo'<script>alert("填写内容不能为空!");history.go(-1);</script>';exit;
      }
      $filename=$_FILES['face']['name'];
      $filesize=$_FILES['face']['size'];
      $filetype=$_FILES['face']['type'];
      $zazhiname=$_FILES['zazhi']['name'];
      $zazhisize=$_FILES['zazhi']['size'];
      $zazhitype=$_FILES['zazhi']['type'];
      //echo $filename."<br>".$filesize."<br>".$filetype;exit;
      $face=explode(".",$filename);
      $face_path="face/".$time1.".".$face[1];
      $facepath="http://127.0.0.1/zazhi/".$face_path;
      $zazhi=explode(".",$zaizhiname);
      $zazhi_path="zazhi/".$time1.".".$zazhi[1];
      $zazhipath="http://127.0.0.1/zazhi/".$zazhi_path;
      //echo $true_pic_path;exit;
      if(!copy($_FILES['face']['tmp_name'],$face_path))
      {
       $facepath="http://127.0.0.1/zazhi/face/noPic.jpg";
      }
      if(!copy($_FILES['zazhi']['tmp_name'],$zazhi_path))
      {
       echo "<script>alert('请选择你要上传的杂志!!');history.go(-1);</script>";
      }
      include"opendata.php";
      $query = "INSERT INTO `zazhi` ( `id` , `name` , `zazhipath` , `facepath` , `description` ) 
    VALUES (NULL , '$name', '$zazhipath', '$facepath', '$description')";
      //$result = mysql_query($query);
      if($result=mysql_query($query))
      {
       echo"<script>alert('你上传成功');</script>";
        echo"<meta http-equiv=\"refresh\" content=\"0;URL=views.php\">" ;
        //echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";
    }
    else
    {
    echo'<script>alert("你上传失败,请重新上传!");history.go(-1);</script>';exit;
    }
    ?>
    请各位帮个忙啊!!急急!!
      

  3.   

    检查一下路径,每一步执行后都echo 一下看看哪里值没传到
      

  4.   

    那是你的上传文件时没有成功也就是zazhi这个字段没有值
    你用echo "$zazhi";
    试试看
      

  5.   

    这个我知道啊!!!我就是问为什么总是得不到FILE
      

  6.   

    为什么总是得不到$zazhi和$face这两个值啊!!!!!!!!!!!