jmjl161100/laravel-chunk-upload is a Laravel package for laravel chunk upload support package..
It currently has 0 GitHub stars and 595 downloads on Packagist (latest version v1.0.0).
Install it with composer require jmjl161100/laravel-chunk-upload.
Discover more Laravel packages by jmjl161100
or browse all Laravel packages to compare alternatives.
Last updated
Laravel package for handling chunked file uploads with multi-driver support (Local, Qiniu, etc.).
composer require jmjl161100/laravel-chunk-upload
Add a new disk to your config/filesystems.php config:
<?php
return [
'disks' => [
//...
'qiniu' => [
'driver' => 'qiniu',
'access_key' => env('QINIU_ACCESS_KEY', 'xxxxxxxxxxxxxxxx'),
'secret_key' => env('QINIU_SECRET_KEY', 'xxxxxxxxxxxxxxxx'),
'bucket' => env('QINIU_BUCKET', 'test'),
'domain' => env('QINIU_DOMAIN', 'xxx.clouddn.com'), // or host: https://xxxx.clouddn.com
],
//...
]
];
use Jmjl161100\ChunkUpload\Facades\CheckUpload;
// initialization
$rt = CheckUpload::init($fileName);
// Upload data in chunks
$rt = CheckUpload::uploadPart($uploadId, $partNumber, $file);
// Complete file upload
$rt = CheckUpload::complete($uploadId, $partList);
JavaScript example (using Axios):
async function uploadFile(file) {
const chunkSize = 5 * 1024 * 1024; // 5MB
const totalChunks = Math.ceil(file.size / chunkSize);
for (let i = 0; i < totalChunks; i++) {
const chunk = file.slice(i * chunkSize, (i + 1) * chunkSize);
await axios.post('/upload-chunk', {
file_id: file.name,
chunk: chunk,
index: i
});
}
await axios.post('/complete-upload', {file_id: file.name});
}
Local Driver
Qiniu
qiniu/php-sdk packageIf you discover any security issues, please email author instead of creating an issue.
MIT License (see LICENSE)