0

When I try to upload images in dropzone from my localhost then I get ERROR! but on server I can upload this successful.This problem made me difficult to test product.

[this is error]

and this is my code

public function storeMedia(Request $request)
{
    //resize image
    $path = storage_path('tmp/uploads');
    $imgwidth = 1000;
    $imgheight = 1000;
    if (!file_exists($path)) {
        mkdir($path, 775, true);
    }
    $file = $request->file('file');
    $name = uniqid() . '_' . trim($file->getClientOriginalName());
    $full_path = storage_path('tmp/uploads/' . $name);
    $img = \Image::make($file->getRealPath());
    if ($img->width() > $imgwidth || $img->height() > $imgheight) {
        $img->resize($imgwidth, null, function ($constraint) {
            $constraint->aspectRatio();
        });
    }
    $img->save($full_path);
}

I think maybe about permission but i'm not sure. I really don't know to solve this problem please help me

Peppermintology
  • 9,343
  • 3
  • 27
  • 51
y.pornwisa
  • 11
  • 6

0 Answers0