PHPDev.org

Laravel, Yii and Bitrix programmers

info@phpdev.org +7 993 898-44-62 +7 993 898-44-62
Order a call
PHPDev.org

Меню

  • Услуги
    • Разработка и поддержка
    • Сайты и веб приложения
    • Интернет-магазин
    • Корпоративные сайты
    • CRM
    • Личные кабинеты
    • Редизайн сайта
    • Готовые решения
    • Бэкэнд для мобайла
    • Разработка Чат-ботов
    • Интеграции
    • CRM
    • Системы доставки
    • Системы оплаты
    • 1C
    • Интеграция 1С с Bitrix и Bitrix24
    • Развитие
    • Обновление Битрикс
    • Обновление PHP
    • Аудит безопасности
    • Удаление вирусов
    • Доработка сайта на Битрикс
    • Верстка сайта по макетам
    • Доработка коробки Битрикс24
    • Перенос с другой CMS на Битрикс
    • Парсинг данных с сайта
    • Ускорение сайта по Google Page Speed
    • Доработка дизайна и структуры сайта для повышения конверсии
    • Техническая поддержка
    • Поддержка интернет-магазина
    • Поддержка сайтов на Битрикс
    • Поддержка сайтов на WordPress
    • Поддержка сайтов на Laravel
  • Support
  • development
  • OUR CASES
    • on Bitrix
    • on Bitrix 24
    • on Laravel
    • on Yii2
  • About company
  • blog
  • Contacts
  • GALLERY
RU | EN
  1. Home
  2. notes
  3. Uploading Large Files in Parts with Laravel

Blog

Uploading Large Files in Parts with Laravel

01/27/2022
1052
When uploading large files to a website, it is usually necessary to configure the php uploadmaxfilesize parameter, which determines the maximum file size. But what if the internet connection is slow and the file takes 30 minutes to upload? In this case, you should also adjust the maxexecutiontime parameter, which determines the script execution time. But what if you don't have access to the php settings? In that case, you need to split the file into parts and upload them separately - let's explore this further.

Let's consider the implementation using the Laravel framework. We will need the following libraries:

  • Resumable.js - a JavaScript library that provides multiple concurrent, stable, and resumable uploads via the HTML5 File API
  • https://github.com/pionl/laravel-chunk-upload - a library for Laravel for uploading files in chunks
  • jQuery

First, download the resumable.js file from the repository https://github.com/23/resumable.js/ and place it in our project /public/js/resumable.js/

Next, we need to install the library https://github.com/pionl/laravel-chunk-upload using composer

composer require pion/laravel-chunk-upload

No access to global composer?

Once all the libraries are installed, let's move on to creating the controller responsible for the upload.

First, add new routes to the file /routes/web.php

Route::get('/files-library', App\Http\Controllers\FilesLibraryController::class, 'filesLibrary')->name('files-library');

Route::post('files-library/upload', App\Http\Controllers\UploaderController::class, 'upload')->name('file-upload');

The path /files-library will be used for the file upload page, and files-library/upload is for the actual upload process.

In the folder /app/Http/Controllers, create a new controller FilesLibraryController.php

// /app/Http/Controllers/FilesLibraryController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class FilesLibraryController extends Controller

{

    public function filesLibrary(Request $request) {

    return view('/files.library')

    }

}

Next, let's create the file uploader controller UploaderController.php

Back to list

ЧИТАЙТЕ ТАКЖЕ

Strange pagination behavior in Bitrix


Связаться с нами:
Политика обработки персональных данных Политика обработки файлов cookie
Разработка и поддержка Интеграции Развитие
Аутстафф Техническая поддержка
Блог Кейсы О компании
220073, РБ, г. Минск,
ул. Ольшевского, 22, офис 20
info@phpdev.org
© PHPDev.ORG, 2025 ООО «ПиЭйчПиДев», УНП 193010251
Quality Performance Website promotion
phpdev.org Laravel, Yii and Bitrix programmers
Laravel, Yii and Bitrix programmers
BY
  • BY
  • RU
  • UA

By clicking the "Submit a request" button, you consent to the processing of Personal data.

phpdev.org Laravel, Yii and Bitrix programmers
Thank you! The application has been successfully sent. We will contact you shortly

Продолжая использовать сайт, вы соглашаетесь с Политикой обработки персональных данных и Политикой использования файлов cookie. .