有这个必要吗??用<input type="file" name="test">不行吗??

解决方案 »

  1.   

    和保存图片差不多吧,改吧
    这是不知什么时期的代码段
    //PHP代码
    if($create) {
    //生成文件
    $connect=@mysql_connect('localhost','***','****');
    $dbname='****';
    $select=mysql_select_db($dbname,$connect);
        $query="select image from imagetable where 1=1";  
    //$query="DELETE FROM imagetable";
        $result=mysql_query($query);
    $all=0;
       while($row=mysql_fetch_object($result))
    {     $all=$all+1;
         echo $row->image;
      }
    echo "<div>";
    echo $all;
    echo "</div>";
      }if($file!="") {    
    //存储图片数据
    //读入上传的图片数据
    $connect=@mysql_connect('localhost','***','***');
    $dbname='***';
    $select=mysql_select_db($dbname,$connect);
        $imagecontent=addslashes(fread(fopen($file,"r"),filesize($file)));
        $query="insert into imagetable(id,image,filename,filetype) values ('','$imagecontent','$file_name','$file_type')";
        if($file!="none" and $file!="") {
    mysql_query($query);
    }
        
    }
    ?>
    <form name="form1" method="post" action="" enctype="multipart/form-data">
      <input type="file" name="file"><INPUT TYPE="hidden" name=create value=1>
      <input type="submit" name="confirm" value="Submit">
    </form>
      

  2.   

    http://expert.csdn.net/Expert/topic/1344/1344404.xml?temp=.3839075
      

  3.   

    直接读文件写文件到数据库吧
    不过为什么要addslash呢?
      

  4.   

    什么啊。"和'也会被转换的啊。
    再slip不就可以恢复了嘛。
      

  5.   

    用silp??
    这么用的 ??呆会我另外开个问题来讨论这个。。
      

  6.   

    还是用
    <input type="file" name="test">
    简单!
      

  7.   

    if($create) {
    //生成文件
    $connect=@mysql_connect('localhost','***','****');
    $dbname='****';
    $select=mysql_select_db($dbname,$connect);
        $query="select image from imagetable where 1=1";  
    //$query="DELETE FROM imagetable";
        $result=mysql_query($query);
    $all=0;
       while($row=mysql_fetch_object($result))
    {     $all=$all+1;
         echo $row->image;
      }
    echo "<div>";
    echo $all;
    echo "</div>";
      }
    这个什么意思?