I have a Problem in File upload in chunks
i want to upload large vedios in chuncks (50mb) in filament FileUpload::class, but im unable to achieve it.
suggest a way to achieve this
2 Replies
@Leandro Ferreira
This is my custom component
chunked-vedio-upload.blade.php
<div id="resumable-upload-container">
<button id="browseButton">Select File</button>
<div id="fileProgress" style="margin-top: 10px;"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/resumable.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
let r = new Resumable({
target: '{{ route("chunked.upload") }}',
query: { _token: '{{ csrf_token() }}' }, // CSRF token
chunkSize: 1 * 1024 * 1024, // 1MB chunks
simultaneousUploads: 3,
testChunks: false,
throttleProgressCallbacks: 1,
});
r.assignBrowse(document.getElementById('browseButton'));
r.on('fileAdded', function (file) {
r.upload();
});
r.on('fileProgress', function (file) {
let progress = Math.floor(file.progress() * 100);
document.getElementById('fileProgress').innerText = `Uploading: ${progress}%`;
});
r.on('fileSuccess', function (file, message) {
document.getElementById('fileProgress').innerText = 'Upload complete!';
});
r.on('fileError', function (file, message) {
document.getElementById('fileProgress').innerText = 'Upload failed!';
});
});
</script>
my filament resource its present in my relationship manager form.
Forms\Components\Field::make('link')
->view('components.chunked-video-upload')->label('Video')
->required(),its coming like this and im unable to select the files