Giter Site home page Giter Site logo

clickyab / chunks-uploader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mehrdad-dadkhah/chunks-uploader

0.0 1.0 0.0 25 KB

uploader to uplaod chunks of a file and combine them use to upload big files.

License: GNU General Public License v3.0

PHP 100.00%

chunks-uploader's Introduction

chunks-uploader

Software License Packagist Version Packagist

uploader to uplaod chunks of a file and combine them use to upload big files.

Installation

composer require mehrdad-dadkhah/chunks-uploader

Usage

use MehrdadDadkhah\Video\ChunksUploader;

$uploadHandeler = new ChunksUploader();
$uploadHandeler->setMainFileName('myFile.mp4') //main file name
            ->setFileTotalSize($_REQUEST['totalfilesize']) //size of main file (big file)
            ->setInputName('file') //your form input file name
            ->setChunksFolderPath('path-to-chunks-folder') //path to folder for upload chunks files
            ->setUniqueIdentifier('unique-id'); // set uinique identifier for each upload (for example user id)

to upload your chunks:

$uploadResult = $uploadHandeler->uploadChunk('name-of-chunk-or-chunk-number');

And when all chunks upload:

$uploadResult = $uploadHandeler->setUploadDirectory('path-to-upload-directory') //main directry path to upload (combine chunks here)
			->finishUpload();

Custome file name

If want to set output file name try use setUploadName() function before fire finishUpload() function:

$uploadHandeler->setUploadName('my-name.mp4');

If don't set name your file name be with structur YYYY_m_d_hashname.mp4 and in final resutl generated name will be return.

Check and generate output directory

If want to script make output directory automatically just set it:

$uploadHandeler->checkAndGenerateOutputDirectory();

Temp directory

If want to generate file in a temp directory and then move to main upload directory you can use setTempDirectory() function:

$uploadHandeler->setTempDirectory('path-to-temp');

License

hls-video-generater is licensed under the GPLv3 License.

chunks-uploader's People

Contributors

mehrdad-dadkhah avatar fzerorubigd avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.