PHP move_uploaded_file目录和mysql表

时间:2015-03-16 18:03:44

标签: php mysql file-upload insert

这样可行:

  if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
    echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
   } else {
    echo "Sorry, there was an error uploading your file.";
     }

这也有效

  echo imagejpeg($image,null,30);
  $image = ob_get_clean();
  ob_end_clean();
  $image = addslashes($image);
  $sql = "INSERT INTO zzimages (`user_id`,`imit`)
  VALUES ('9','$image')";

但是当我尝试使用$ image插入目录时,它不起作用。我需要使用$ image,因为它代表了正确旋转的图像。

所以这不起作用,请告知:

     if (move_uploaded_file($image, $target_file)) {
     echo "this needs to work"}

0 个答案:

没有答案