1. Go to this page and download the library: Download gelatocloud/flow-php-server 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/ */
gelatocloud / flow-php-server example snippets
if (\Flow\Basic::save('./final_file_destination', './chunks_temp_folder')) {
// file saved successfully and can be accessed at './final_file_destination'
} else {
// This is not a final chunk or request is invalid, continue to upload.
}
$config = new \Flow\Config();
$config->setTempDir('./chunks_temp_folder');
$file = new \Flow\File($config);
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($file->checkChunk()) {
header("HTTP/1.1 200 Ok");
} else {
header("HTTP/1.1 404 Not Found");
return ;
}
} else {
if ($file->validateChunk()) {
$file->saveChunk();
} else {
// error, invalid chunk upload request, retry
header("HTTP/1.1 400 Bad Request");
return ;
}
}
if ($file->validateFile() && $file->save('./final_file_name')) {
// File upload was completed
} else {
// This is not a final chunk, continue to upload
}
\Flow\Uploader::pruneChunks('./chunks_folder');
if (1 == mt_rand(1, 100)) {
\Flow\Uploader::pruneChunks('./chunks_folder');
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.