PHP code example of tranthinh-coding / upload-large-file

1. Go to this page and download the library: Download tranthinh-coding/upload-large-file 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/ */

    

tranthinh-coding / upload-large-file example snippets


return [
    /*
     |--------------------------------------------------------------------------
     | Đường dẫn lưu trữ file tạm thời
     |--------------------------------------------------------------------------
     |
     */
    'temp_path' => 'chunk-upload-temp',

    /*
     |
     | Thời gian hết hạn cho file tạm thời
     | Default: 24h
     */
    'chunk_expire' => 60 * 60 * 24,

    /*
    |--------------------------------------------------------------------------
    | Thư mục gốc lưu trữ file
    |--------------------------------------------------------------------------
    |
     */
    'dir_path' => 'uploads',

    /*
    |--------------------------------------------------------------------------
    | Quy tắc tạo thư mục con
    |--------------------------------------------------------------------------
    |
    | | 【Cài đặt chung】Phân theo năm, theo tháng, theo ngày, thư mục con hằng số.
    |
    | | Hỗ trợ các tùy chọn: 'year', 'month', 'date', 'const'
    |
    */
    'resource_subdir_rule' => 'month',

    'storage_disk' => 'local',

    'cache_driver' => 'file',

];

$uploadLargeFile = new Think\UploadLargeFile();

$uploadLargeFile->folder('uploads')
    ->upload($request);
bash
php artisan vendor:publish --tag="upload-large-file-config"