Mehrdad-Dadkhah / chunks-uploader

uploader to uplaod chunks of a file and combine them use to upload big files.
GNU General Public License v3.0
8 stars 3 forks source link

Don't you need some javascript for this? #2

Open jackttcoms opened 5 years ago

jackttcoms commented 5 years ago

Does this require any javascript? Also out of 10, how secure would you say this class is? Thanks

Mehrdad-Dadkhah commented 5 years ago

Hi @jackttcoms It needs chunks of file data and yes you can do it with js like flow.js or FineUploader lib.

It By default check list of valid mime types. Do you have any suggestion?

jackttcoms commented 5 years ago

Wonderful. Not not really. It looks very secure to me 👍 .

Also does this have random file name capabilities? e.g. upload bob.zip and it uploads it as ajhdbfjfbjfbgjkwgbjkgbwjkfwbjkbgj.zip and can you please create a working sample so i can see how it works properly.

Can i explain my needs for my project. Basically I have a form with 5 input fields. I only need the chunking for one field (the zip field), can i achieve this with your class. Do everything at the same time? Click submit.....chunk file and insert data into database?

Here are the fields: Name Bio Image Image Zip

Thanks very much.

Mehrdad-Dadkhah commented 5 years ago

Ok.

Yes you can. you should set a js lib for Zip input that send chunked data to server then in server you should pass data to my package

jackttcoms commented 5 years ago

Hi, can this be done with jquery file upload? if so would it be possible for you to create a really simple working example?

This is my code so far based on urs but am unsure with certain elements if i am doing it right so help would be much appreciated in getting a working chunk upload form working. Thanks

<?php
    //add composer autoloader
    require '../vendor/autoload.php';

    use MehrdadDadkhah\Video\ChunksUploader;

    $uploadHandeler = new ChunksUploader();
$uploadHandeler->setMainFileName('avatar.jpg') //main file name ??? dynamic name
            ->setFileTotalSize($_REQUEST['totalfilesize']) //size of main file (big file)
            ->setInputName('files') //your form input file name
            ->setChunksFolderPath('../chunk-folder') //path to folder for upload chunks files
            ->setUniqueIdentifier('unique-id' . time()); // set unique identifier for each upload (for example user id + time or ...) a unique indentifier per each upload ??? have i done this right

            $uploadHandeler->checkAndGenerateOutputDirectory();

            $uploadResult = $uploadHandeler->uploadChunk('name-of-chunk-or-chunk-number'); //should be a sortable name ??? confused here

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

Thanks

jackttcoms commented 5 years ago

Can this work with ResumableJs????

Mehrdad-Dadkhah commented 5 years ago

Yes, it can. You should only pass data that ResumableJs send to server @jackttcoms

jackttcoms commented 5 years ago

Any chance of an example of your script in use? Thanks