PHP code example of cnviradiya / laravel-filepond
1. Go to this page and download the library: Download cnviradiya/laravel-filepond library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cnviradiya / laravel-filepond example snippets
artisan vendor:publish --provider="cnviradiya\LaravelFilepond\LaravelFilepondServiceProvider"
...
use cnviradiya\LaravelFilepond\Filepond;
class YourController extends Controller
{
// This is the demo function you have to write this code in your actual function
public function update(Request $request, Filepond $filepond)
{
// Start file upload process from temp to your actual directory
$path = $filepond->getPathFromServerId($request->input('upload_file')); // Here upload_file is your name of your element
$pathArr = explode('.', $path);
$imageExt = '';
if (is_array($pathArr)) {
$imageExt = end($pathArr);
}
$fileName = 'upload_file.' . $imageExt;
$finalLocation = storage_path('uploads/' . $fileName);
\File::move($path, $finalLocation);
}
}