Laravel does not upload small size file

  laravel, laravel-5.8, php

I’m working with Laravel 5.8 and I wanted to upload two custom files so I coded this:

if ($request->file('prd_file') AND $request->file('prd_file_preview')) {
    $file = Request::file('prd_file');
    $filename = $file->getClientOriginalName();
    $path = public_path().'/upload/products/';
    $request->file('prd_file')->move($path, $filename);
    $file_preview = Request::file('prd_file_preview');
    $filename_preview = $file_preview->getClientOriginalName();
    $path_preview = public_path().'/upload/products/preview/';
    $request->file('prd_file_preview')->move($path, $filename_preview);
}

But after process gets completed nothing is uploaded at /upload/products/ directory and /upload/products/preview.

And at the database, just these values gets inserted:

capture

So what’s going wrong here? I don’t think this is because of file sizes. Because post_max_size is set to 256M and the files I’m trying to upload are just 928 bytes and 409 bytes.

I would really appreciate any idea or suggestion from you guys about this…

Source: Laravel

Leave a Reply