【发布时间】:2023-01-04 00:42:24
【问题描述】:
我在控制器中使用此代码成功创建了目录:
$cpath = public_path().'/files/completed/'.$file['customer_name'];
if (! File::exists($cpath)) {
File::makeDirectory($cpath);
}
但我不确定如何将相关文件移动到这些目录,因为我试过这个:
File::move('files/pending/'.$filename,'files/completed/'.$file['customer_name'].$filename);
但问题是我没有在各自的目录中获取任何文件,但文件正在移动,名称重命名为 (companyname filename.850) 这不是我想要的,这里是我如何在控制器中为目录和文件:
$cpath = public_path().'/files/completed/'.$file['customer_name'];
if (! File::exists($cpath)) {
File::makeDirectory($cpath);
}
File::move('files/pending/'.$filename,'files/completed/'.$file['customer_name'].$filename);
感谢您的答复!
【问题讨论】:
标签: php laravel laravel-5 eloquent