2017 © Pedro Peláez
 

library lara-simple-ajax-uploader

Simple Ajax Uploader for Laravel. Multifile, inline and singlefile

image

unamatasanatarai/lara-simple-ajax-uploader

Simple Ajax Uploader for Laravel. Multifile, inline and singlefile

  • Sunday, April 2, 2017
  • by unamatasanatarai
  • Repository
  • 1 Watchers
  • 0 Stars
  • 22 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

@include('sau::inline', ['allow' => 'mp3, jpg, png, svg ', 'url' => route('assets.upload.file'), 'buttonCaption' => __('Wybierz plik'), 'name' => 'ufile_xls', 'value' => '', 'label' => 'Plik XLS', 'displayName' => __('Upuść tu plik, lub kliknij')])
@include('sau::image', ['url' => route('assets.upload.image'), 'name' => 'main_image', 'value' => '', 'label' => 'Główny obrazek', 'displayName' => __('Upuść tu plik, lub kliknij')])
@include('sau::images', ['url' => route('assets.upload.image'), 'name' => 'main_image2', 'value' => '', 'label' => 'Główny obrazek', 'displayName' => __('Upuść tu plik, lub kliknij')])

service provier:
Unamatasanatarai\SimpleAjaxUploader\SimpleAjaxUploaderServiceProvider::class,, (*1)

example controller (@TODO: rethink implementation) ```<?php, (*2)

namespace App\Http\Controllers;, (*3)

use Illuminate\Support\Str; use Unamatasanatarai\SimpleAjaxUploader\FileUpload;, (*4)

class AssetsController extends Controller {, (*5)

   public function image()
   {
       $upload_dir = public_path('u/');
       $uploader = new FileUpload('uploadfile');
       // Handle the upload
       $result = $uploader->handleUpload($upload_dir);
       if ( ! $result ) {
           exit(json_encode([ 'success' => false, 'msg' => $uploader->getErrorMsg() ]));
       }
       if ( ! $uploader->isWebImage($uploader->getSavedFile()) ) {
           return response()->json([
               'success' => false,
               'error'   => __('Można wgrać tylko obrazki/zdjecia'),
           ]);
       }
       $newFilename = Str::slug($uploader->getFileNameWithoutExt()) . '_' . time() . '_' . uniqid() . '.' . $uploader->getExtension();

       copy($upload_dir . $uploader->getFileName(), $upload_dir . $newFilename);

       return response()->json([
           'success'     => true,
           'fileFullUrl' => asset('u/' . $newFilename),
           'fileUrl'     => $newFilename,
       ]);
   }```

https://packagist.org/packages/unamatasanatarai/lara-simple-ajax-uploader, (*6)

The Versions

02/04 2017

dev-master

9999999-dev https://github.com/unamatasanatarai/lara-simple-ajax-uploader

Simple Ajax Uploader for Laravel. Multifile, inline and singlefile

  Sources   Download

MIT

ajax upload laravel multi upload

02/04 2017

1.1

1.1.0.0 https://github.com/unamatasanatarai/lara-simple-ajax-uploader

Simple Ajax Uploader for Laravel. Multifile, inline and singlefile

  Sources   Download

MIT

ajax upload laravel multi upload