数据未上传到数据库中,但图像已上传,并且不会重命名文件。我是PHP的新手,感谢任何帮助。
$hash is md5() hash of image
$j is hash(hash(image).date)
$newfile = $hash.".".$file_extension;
$l2 is link address.
if (file_exists($final_dir))
{
$newfile = $j.'.'.$file_ext; //This will rename file with current time stamp which will always unique.
$l2="$l"."$newfile";
$hash = $j;
}
$upload = move_uploaded_file($filetmp,$final_dir); //uploading the file to the server
$select_query = "INSERT INTO image_table(i_name,i_location,i_hash,image_url) VALUES('$newfile','$final_dir','$hash','$l2')"; // Database query
$selected = mysqli_query($connect,$select_query);