I'm having an issue with files upload in Laravel-8
try {
foreach ($request->file('images') as $image) {
$newsImage = new NewsImage();
$newsImage->news = $request->news;
$newsImage->path = $image->store('news/'.$request->news);
$newsImage->save();
}
return redirect()->back()->with('status', 'Imagens cadastradas com sucesso!');
} catch (\Exception $exception) {
return redirect()->back()->withErrors([$exception->getMessage()]);
}
When I run the code, it goes well until line 5, where the code executes, and save the file as I want it to do, but it throws an exception and stops the execution
In the exception the message is
chmod(): Operation not permitted
I've no idea of where the problem is, since line 5 works, but it throws an exception too.
Is there a way to not run the chmod command with the Laravel native store
function?
I'm working with docker for windows with WSL. All folders are with 0777 permissions.