1. Go to this page and download the library: Download hgouveia/ng-upload-chunked 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/ */
hgouveia / ng-upload-chunked example snippets
// In your POST handler
/*
$defaultConfig = [
"ext" => ".part",
"fileInputName" => "file",
"directoryPermission" => 0755,
"readChunkSize" => 1048576, // 1MB
"uploadDirectory" => "",
"tempDirectory" => "",
];
*/
$nguc = new \NGUC\NgUploadChunked(); //optional $config param
try {
// Contains the information of the current chunk
$chunk = new \NGUC\NgFileChunk(
$_POST['_uniqueId'],
$_FILES['file']['name'],
$_POST['_chunkSize'],
$_POST['_currentChunkSize'],
$_POST['_chunkNumber'],
$_POST['_totalSize'],
);
// this could be used instead, if ng-file-upload is beign used
//$chunk = new \NGUC\NgFileChunk();
//$chunk->populate($_POST['_uniqueId'], $_FILES['file']['name']);
$nguc->process($chunk);
// response the path when finished
if ($nguc->isFinished()) {
echo $nguc->getUploadPath();
}
} catch (\NGUC\NGUCException $e) {
echo "ERROR: " . $e->getCode() . " - " . $e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.