使用$ php

时间:2017-06-02 04:26:52

标签: php html css

修复我的代码,我得到错误:C:\ xampp \ tmp \ php7A7B.tmp 我在上传图片时遇到此错误,你可以修复它吗

否则:我希望在我的上传文件夹上添加上传此服务的每张图片

<html>
<head>
     <title>imgfox upload images</title>
</head>
<body>

<form action="upload.php" method="POST" enctype="multipart/form-data">
   image:
   <input type="file" name="image"> <input type="submit" value="upload">
</form>

<?php 
// connect to database
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("meinimages") or die(mysql_error());

// file properties
if(isset($_FILES['image'])){
    echo $_FILES['image']['tmp_name'];
}
if (!isset($file))
    echo "please choose a image.";
else
{
 $image = addslashes(file_get_contents($_FILES['image']['tmp_name']));  
 $image_name = addslashes($_FILES['image']['name']);
 $image_size = getimagesize($image);

 if ($image_size==FALSE)
     echo "you try upload no/..image.";
else
 {
    if (!$insert = mysql_query("INSERT INTO store VALUES ('','$image_name','$image')"))
      echo "problem while upload $image.";
    else
    {
      $lastid = mysql_insert_id();
      echo "image is uploaded.<p />your image:<p /><img src=get.php?id=$lastid>";
    }



 }

}

0 个答案:

没有答案