我无法使用move_uploaded函数将上传的文件移动到所需的路径。 请帮帮我。
我试图将语法更改为以下形式:- $ destination_path = getcwd()。DIRECTORY_SEPARATOR; $ target_path = $ destination_path。 basename($ _FILES [“ profpic” [“ name”]); 然后也做不到。
if(isset($_POST['otp-btn'])){
$otpa = $_POST['otp'];
$file_n = $_COOKIE['file_name'];
if($_COOKIE['otp'] == $otpa){
$destination = '/adhaar';
if(!move_uploaded_file($_COOKIE['tmp'], "$destination/$file_n")){
echo "<script>alert('File is not uploaded')</script>";
}
}
每个变量都在获取信息(诸如$ _COOKIE ['tmp'],$ file_n之类的变量)不为空。我回应了它,并传达了信息。
文件未上传。
答案 0 :(得分:-1)
if(isset($_POST['otp-btn'])){
$otpa = $_POST['otp'];
$file_n = $_COOKIE['file_name'];
if($_COOKIE['otp'] == $otpa){
$destination = './adhaar';
if(!move_uploaded_file($_COOKIE['tmp'], "$destination/$file_n")){
echo "<script>alert('File is not uploaded')</script>";
}
}
尝试一下。