Upload multimedia files in Laravel 5.7

In this blog post, we learn how to upload multimedia files in Laravel 5.7

Files uploading in any application is very useful tasks to upload multimedia files in Laravel 5.7 is a very easy task. first, we need to create a simple view form to upload a file and a new controller where we make logic code to upload file is Laravel.

In a view file, we need to create a form by adding the following line of code.

Form::open(array('url' => '/uploadfile','files'=>'true'));

When you add this line of code may be a chance to give an error so here is the solution  click

Step 1: Create a view file called resource/view/upload.php


       {!! Form::open(array('route' => 'files.upload', 'files' => true,'method'=>'post')) !!}

        {{ Form::label('file', 'Upload New File:') }}
        {{ Form::file('file', null, array('required' => '')) }}

        {!! Form::submit( 'Upload Files', ['name' => 'upload', 'value' => 'upload'])!!}

        {!! Form::close() !!}

Step 2 − Create a new controller called UploadFileController by executing the following command.

php artisan make:controller UploadFileController 

After that add some code to upload a file in the folder.


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class UploadFileController extends Controller {
   public function index() {
      return view('uploadfile');
   public function showUploadFile(Request $request) {
      $file = $request->file('image');
      //Display File Name
      echo 'File Name: '.$file->getClientOriginalName();
      echo '<br>';
      //Display File Extension
      echo 'File Extension: '.$file->getClientOriginalExtension();
      echo '<br>';
      //Display File Real Path
      echo 'File Real Path: '.$file->getRealPath();
      echo '<br>';
      //Display File Size
      echo 'File Size: '.$file->getSize();
      echo '<br>';
      //Display File Mime Type
      echo 'File Mime Type: '.$file->getMimeType();
      //Move Uploaded File
      $destinationPath = 'uploads';

Step 3: Add route in routes/web.php


Step 4: Enter this URL  in the browser


You will result in some like this...

Upload multimedia files in Laravel 5.7



About Author
  • user profile
    Brijpal Sharma

    brijpalsharma99@gmail.com, January 29th, 2018

    Hello, My Name is Brijpal Sharma. I am a Web Developer, Professional Blogger and Digital Marketer from India. I am the founder of Codermen. I started this blog to help web developers & bloggers by providing easy and best tutorials, articles and offers for web developers and bloggers...

1 Comment

user profile image
January 03rd, 2019 - 4:25PM


You must be logged in to post a comment.

You may also be interested in...
Upload multimedia files in Laravel 5.7