PHP移动上传文件目录和mysql表
所以这是可行的:PHP移动上传文件目录和mysql表,php,mysql,file-upload,insert,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.";
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"}
您需要确保目标$target_文件目录有权将能够写入目标目录的文件移动到目标目录,并且该目录归CentOS中的web服务器用户apache或Ubuntu中的www数据所有。正如我所说,当我引用$_文件[fileToUpload][tmp_name]时,move_upload_工作,但我需要引用$image作为上载文件。