0

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.

Hedayatullah Sarwary
  • 2,664
  • 3
  • 24
  • 38
RodrigoBorth
  • 101
  • 4
  • Does this answer your question? [Changing permissions via chmod at runtime errors with "Operation not permitted"](https://stackoverflow.com/questions/1592303/changing-permissions-via-chmod-at-runtime-errors-with-operation-not-permitted) – Martin Zeitler Apr 23 '21 at 01:10
  • @MartinZeitler i've seen this question before, but unfortunaly it not helps – RodrigoBorth Apr 23 '21 at 01:23

0 Answers0