php抓取显示空数据如何解决

时间:2017-09-28 06:07:25

标签: php mysql

文件上传然后我选择  只是注意但我的文件路径是自动加载我不想加载我的路径如何可能

然后我提取我的数据库显示我的文件路径只是不想显示我的代码路径所以我不选择任何文件我只选择注意文本如何可能enter link description here

my code
-------
t>
        <?php 

 $alert = ( isset($_REQUEST['alert']) ) ? trim($_REQUEST['alert']):'';


 $im=$_FILES['image'];
 $rnd = rand(1,1000);
 $path = "../home_image/";
 $im_name = $rnd."_".$im['name'];
 $fullpath =$path. $im_name;
 $value_fullpath = empty($fullpath) ? null : ($fullpath);





if($im['error']==0)
{
  if($im['type'] == "image/jpeg" or $im['type'] == "image/gif" or $im['type'] == "image/png")
    {
  copy($im['tmp_name'],$fullpath);

    }
    }



 $imp=$_FILES['imagep'];
 $rnd = rand(1,1000);
 $path = "../home_image/";
 $im_name = $rnd."_".$imp['name'];
 $fullpathp=$path.$im_name;
  $value_fullpath = empty($fullpath) ? null : ($fullpath);

if($im['error']==0)
{
  if($im['type'] == "image/jpeg" or $im['type'] == "image/gif" or $im['type'] == "image/png")
    {
  copy($imp['tmp_name'],$fullpathp);

    }

       }






    if(isset($_REQUEST['submit']))

    {


  echo $sql="INSERT INTO `home_page`(`slider_image`,`notice`,`prtofolio`) 
                        VALUES ('$value_fullpath','$alert','$fullpathp')";


 echo $query=mysqli_query($conDB,$sql) or die (mysqli_error());
 header('location:homepage_show.php');


    }






?>



        <table width="687" id="rounded-corner" summary="2007 Major IT Companies' Profit" >
            <form action="<?php echo $_SERVER['PHP_SELF']; ?>" name="myForm" method="post" enctype="multipart/form-data" onsubmit="return(validate());">

          <tr>
            <td> slect slider image</td>
            <td><input type="file"  name="image"cols="60" rows="2"></textarea></td>

          <tr>

          <tr>
            <td> notice for home page </td>
            <td><input type="text"  name="alert"cols="60" rows="2"></textarea></td>

          <tr>

          <tr>
            <td> protofolio  </td>
            <td><input type="file"  name="imagep"cols="60" rows="2"></textarea></td>

          <tr>
          <tr>
            <td>&nbsp;</td>
            <td></td>
          <tr>
            <td><input type="submit" name="submit" value="submit"/></td><td></td>

          </tr>
        </table>
        <div class=""> <span class="disabled"> </span> </div>
      </div>
      <!-- end of right content--> 
    </div>
    <!--end of center content -->
enter code here

0 个答案:

没有答案