File 使用laravel 5重命名图像
我有一个带有图像的目录,我向用户显示,用户可以重命名图像,我有一个带有图像的文件 $images=File::files('img'); $image=$images[0]; 但我不知道如何重命名图像。File 使用laravel 5重命名图像,file,laravel-5,rename,File,Laravel 5,Rename,我有一个带有图像的目录,我向用户显示,用户可以重命名图像,我有一个带有图像的文件 $images=File::files('img'); $image=$images[0]; 但我不知道如何重命名图像。 谢谢您可以先从输入中检索它。并使用您定义的文件名移动它。 您的图像将使用您指定的文件名显示 $picture= $request->file('image'); $fileName = 'what the image you want to call'; $picture->m
谢谢您可以先从输入中检索它。并使用您定义的文件名移动它。 您的图像将使用您指定的文件名显示
$picture= $request->file('image');
$fileName = 'what the image you want to call';
$picture->move('image/foo', $fileName);
兄弟,这是我的工作。我希望,这能达到你的目的
$destinationPath = "uploadedImages";
$newName = md5_file($request->file('file_name')->getRealPath());
$guessFileExtension = $request->file('file_name')->guessExtension();
$file = $request->file('file_name')->move($destinationPath, $newName.'.'.$guessFileExtension);
你能告诉我打印($image)的结果吗?