Uploader

A Laravel library to provide file upload utilities. A Javascript library builds a complete file upload widget with upload button, drag-and-drop zone, progress bar and result builder. A controller is available to manage uploaded files. Current version: 3.0.4. Project on GitHub. Project on Packagist. This demosite sources available here.

On this site, you can only upload files up to 1MB and having extensions png,jpg,jpeg,gif,txt. Files will be destroyed after 10 minutes.

Simple uploader

This uploader simply uploads files and then displays result in an alert <div> that disappears after a while. All you need to know about file processing available here.

In your controller create an instance of UploaderHelper and pass the variable to the view.


$uploader = UploaderHelper::init(
  'uploaderdiv', //uploader id
  'Uploader', //label
  route('fileupload'), // route for file prodessing
  [
    'csrfrefreshroute' => route('refreshcsrf'), // route called if csrf token must be reloaded
    'acceptable_mimes' => 'png,jpg,jpeg,gif,txt', // comma-separated list of valid extensions
    'maxfilesizek' => 1024, // max file size
    'path' => '/uploads', // folder in storage where files must be uploaded
    'storagename' => 'public', // file storage name, see Laravel doc
    'overwrite' => true, // files can be overwritten, if false, new name is generated
    'multiple' => true // multiple files can be uploaded
  ]
);
return view('template', ['uploader' => $uploader]);

Then just insert the variable in the appropriate section in your view: {!! $uploader !!}

Demo