Skip to content

A laravel plugin for receive base64 file, store and generate url. Then get the file from the url.

License

Notifications You must be signed in to change notification settings

codegor/laravel-file-process

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-file-process

A laravel plugin for receive base64 file, store and generate url. Then get the file from the url.

How to install?

  1. Install File API

    composer require codegor/laravel-file-process
  2. publish config file

    php artisan vendor:publish --provider="Codegor\Upload\Providers\UploadServiceProvider" --tag=config

How to config?

in config/upload.php

  1. fill in the extansion of acepted files.

    'extantion' => 'jpeg,jpg,png,bmp,svg,gif,pdf,doc,docx,xls,xlsx',
  2. fill in the secret for url encode (.env or config/upload.php).

    .env

    UPLOAD_SECRET=TZi+PA3dT8BR7yproQcqUryieefUbp3iedGQXCMvcSA=
    UPLOAD_VI=+dOnDRg9kO8arkWlsLDyMQ==

    You can regenerate it paste to PHP Tester this code:

    <?php
    echo 'UPLOAD_SECRET='.base64_encode(openssl_random_pseudo_bytes(32));
    echo PHP_EOL;
    echo 'UPLOAD_VI='.base64_encode(openssl_random_pseudo_bytes(openssl_cipher_iv_length('AES-256-CBC')));
  3. fill in the route group for grop of route file - (def route path is '/file/{hash}')

    'route_group' => [... your group route config],

How to use?

For save file from a client (file in base64 encoding) do this:

$url = \Codegor\Upload\Store::uploadFileRndName($extentionOfFile, $base64DataOfFile); 
// $url = '/file/xozYGselci9i70cTdmpvWkrYvGN9AmA7djc5eOcFoAM='

If you try to view from the browser the $url you will see it, becouse route and contoller present on this library.

Store path: {storege}/app/file/{user_id}[/0..xx?]/{hash}.{ext}

More informayion you can see at code (folder src)

About

A laravel plugin for receive base64 file, store and generate url. Then get the file from the url.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages