LaravelPackages.net
Acme Inc.
Toggle sidebar
novius/laravel-easy-upload

This packages makes it way easier to deal with file uploads and src

3.174
0
1.2.0
About novius/laravel-easy-upload

novius/laravel-easy-upload is a Laravel package for this packages makes it way easier to deal with file uploads and src. It currently has 0 GitHub stars and 3.174 downloads on Packagist (latest version 1.2.0). Install it with composer require novius/laravel-easy-upload. Discover more Laravel packages by novius or browse all Laravel packages to compare alternatives.

Last updated

Easy Upload

Travis Packagist Release Licence

Treat file uploading as if it was just a text input

Installation

composer require novius/laravel-easy-upload

Then add this to config/app.php:

// in 'providers' => [ ... ]
Novius\EasyUpload\EasyUploadServiceProvider::class,

// in 'aliases' => [ ... ]
'Upload' => Novius\EasyUpload\Support\Renderer::class,

Use

In a view:

<form action="…">
    <input name="title">
    <textarea name="description">
    {{ Upload::input(['name' => 'avatar_src']) }}
</form>

This will provide a <input type="hidden"> tag and a <input type="file"> tag. As soon as the user specify a file, it will be uploaded through ajax, and the resulting file src will be stored in the hidden inout value attribute.

Possible options are:

{{ Upload::input([
    'name' => 'avatar_src', // default: file_src
    'attribute' => 'data-name', // default: name
    'value' => 'upload/my-image-1234.jpg',
    'class' => 'any-class-you-want or-several-at-the-same-time'
]) }}

{{ Upload::link([ // show the uploaded file link
    'link_attributes' => 'class="my-link"',
    'accept' => '.pdf,.zip',
]) }}

{{ Upload::image([ // preview the uploaded picture
    'accept' => 'image/*',
]) }}

Star History Chart