我当前的文件夹路径是$path = car_images;
它对我有用。我可以直接将我的图片上传到这个文件夹中。但我想为每个用户创建单独的文件夹。所以现在图像应该上传到$path = car_images/$emp_code;
意味着我想首先$emp_code在car_images文件夹中创建名称为目录的目录,然后将$emp_code图像上传到目录中。
我当前的代码没有在 car_images 文件夹中创建目录。
$path = "car_images/".$emp_code;
if (!is_dir($path.'/'.$emp_code))
{
mkdir($path.'/'.$emp_code, 0777, true);
}
$name = $_FILES['car_images']['name'][$i];
$size = $_FILES['car_images']['size'][$i];
list($txt, $ext) = explode(".", $name);
$file= time().substr(str_replace(" ", "_", $txt), 0);
$info = pathinfo($file);
$filename = $file.".".$ext;
if(move_uploaded_file($_FILES['car_images']['tmp_name'][$i], $path.$filename))
{
$file_name_all.=$filename.",";
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 angular 8,并希望在不刷新整个页面的情况下在同一 url 上刷新我的组件。我正在尝试使用 router.navigate 但它对我不起作用。我尝试过
location.reload,window.location.reload但它花费了太多时间并且刷新了整个页面。以下是我的相同代码:
this.snackBar.open('Data Updated Successfully', 'Undo', {
duration: 5000,
});
this.router.navigate(['/get_customer_details/'+this.customer_details_id]);
console.log(this.customer_details_id);
this.ngOnInit();
Run Code Online (Sandbox Code Playgroud)