SkillAgentSearch skills...

Upload

Ajax Upload Large File Support jQuery-File-Upload, FileApi, Plupload, Dropzone, Filepond for Laravel

Install / Use

/learn @recca0120/Upload
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Donate

Pure Ajax Upload And for Laravel (Support jQuery-File-Upload, FileApi, Plupload)

StyleCI Build Status Total Downloads Latest Stable Version Latest Unstable Version License Monthly Downloads Daily Downloads Scrutinizer Code Quality Code Coverage

Features

Installing

To get the latest version of Laravel Exceptions, simply require the project using Composer:

composer require recca0120/upload

Laravel

publish

artisan vendor:publish --provider="Recca0120\Upload\UploadServiceProvider"

How to use

Controller


use Illuminate\Http\JsonResponse;
use Illuminate\Http\UploadedFile;
use Recca0120\Upload\UploadManager;

class UploadController extends Controller
{
    public function upload(UploadManager $manager)
    {
        $driver = 'plupload'; // or 'fileapi'
        $inputName = 'file'; // $_FILES index;

        return $manager->driver($driver)->receive($inputName);

        // or
        return $manager
            ->driver($driver)
            ->receive($inputName, function (UploadedFile $uploadedFile, $path, $domain, $api) {
                $filename = $uploadedFile->getBasename();

                return new JsonResponse([
                    'name' => $uploadedFile->getClientOriginalName(),
                    'tmp_name' => $path.$filename,
                    'type' => $uploadedFile->getMimeType(),
                    'size' => $uploadedFile->getSize(),
                    'url' => $domain.$path.$filename,
                ]);
            });
    }
}

Factory

use Recca0120\Upload\Receiver;
use Illuminate\Http\JsonResponse;

require __DIR__.'/vendor/autoload.php';

$config = [
    'chunks' => 'path_to_chunks',
    'storage' => 'path_to_storage',
    'domain' => 'http://app.dev/',
    'path' => 'web_path'
];

Receiver::factory($config, 'fileapi')->receive('file')->send();

Standalone


use Recca0120\Upload\Drivers\FileAPI;
use Recca0120\Upload\Receiver;

require __DIR__.'/vendor/autoload.php';

$config = [
    'chunks' => 'path_to_chunks',
    'storage' => 'path_to_storage',
    'domain' => 'http://app.dev/',
    'path' => 'web_path'
];

// if use Plupload, new Recca0120\Upload\Plupload
$receiver = new Receiver(new FileAPI($config));
// save to $config['storage'];
$receiver->receive('file')->send();
View on GitHub
GitHub Stars80
CategoryCustomer
Updated1y ago
Forks17

Languages

PHP

Security Score

85/100

Audited on Feb 21, 2025

No findings