B
B
BonBon Slick2016-11-29 16:10:33
Laravel
BonBon Slick, 2016-11-29 16:10:33

Store( ) doesn't work, but move( ) does?

I have an array of photos from a form. In this example, I check if there are files in the array, if there are, then I save them. The store() method doesn't work for some reason, but move() does. Why?

if($request->hasFile('gallery')){
    foreach ($request->gallery as $value) {
      $extension = $value->extension();
      $imgName = md5($value->getClientOriginalName()).'.'.$extension;
      // $value->move(public_path('imgs'), $imgName); --- работает
      $value->store('imgs');
    }
  }

Filesystems.config
'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'visibility' => 'public',
        ],
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2016-11-29
@BonBonSlick

What's wrong?
Most likely you need to chmod give the storage folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question