我最近安装了Chumper / Zipper,并尝试将文件上传到zip文件中。但是,当我打开zip文件时,所有上传的文件都已重命名,并且文件扩展名也被删除。例如,当我将图像上传为image.png时,它将更改为php20V2Wx。有谁知道我该如何解决?
存储文件的方法
public function store(Request $request)
{
foreach ( $request->files as $files ){
\Zipper::make(public_path('tests.zip'))->add($files)->close();
}
return response()->download(public_path('tests.zip'));
}
$文件输出
Array([0] => Symfony \ Component \ HttpFoundation \ File \ UploadedFile 对象( [test:Symfony \ Component \ HttpFoundation \ File \ UploadedFile:private] => [originalName:Symfony \ Component \ HttpFoundation \ File \ UploadedFile:private] => favicon.ico [mimeType:Symfony \ Component \ HttpFoundation \ File \ UploadedFile:private] =>图片/ x图标[大小:Symfony \ Component \ HttpFoundation \ File \ UploadedFile:private] => 5686 [错误:Symfony \ Component \ HttpFoundation \ File \ UploadedFile:private] => 0 [pathName:SplFileInfo:private] => / tmp / php4tQEul [fileName:SplFileInfo:private] => php4tQEul))