标题不工作删除配置文件功能 [英] Header not working on delete profile function
本文介绍了标题不工作删除配置文件功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个上传功能,它具有删除功能。
请参阅下面我在MyProfile上运行的deleteProfile代码,一旦我选择删除文件,它会重定向到'deleteProfile.php'下的空白页面,而我希望它保持在MyProfile.php
有人可以帮忙吗?
我尝试了什么:
Hi
I have an upload feature which has a delete feature on this.
See below my deleteProfile code which runs on MyProfile, once i select delete file it redirects to a blank page under 'deleteProfile.php' whereas I want it to stay on MyProfile.php
can someone help?
What I have tried:
<?php
session_start();
include("dbConnect.php");
header("Location:myProfile.php")
$sessionid = $_SESSION['currentUserID'];
$filename = "uploads/profile".$sessionid. "*";
$fileinfo = glob($filename); //all files matches the search above
//Where we want to explode and which string we want to explode
$fileext = explode(".", $fileinfo[0]); // first result from array from glob search
$fileactualext = $fileext[1]; // e.g actual ext equal to for example jpeg
$file = "uploads/profile".$sessionid. ".". $fileactualext;
//delete file
if (!unlink($file)){
echo "File was not deleted";
}else{
echo "file was deleted!";
}
$stmt = $conn->prepare("UPDATE Profile SET ProfilePicture='{$fileNameNew}' WHERE UserID='{$sessionid}'");
$stmt->execute();
echo "<img src='uploads/default-profile.jpg' width='150' height='150'/>";
header("Location:myProfile.php?deletesuccess=1")
?>
推荐答案
sessionid =
sessionid =
_SESSION ['currentUserID'];
_SESSION['currentUserID'];
filename =uploads / profile。
filename = "uploads/profile".
这篇关于标题不工作删除配置文件功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文