PHP code example of dicicip / php-file-upload

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

    

dicicip / php-file-upload example snippets




class YourClass
{
    private $fileUtil;
    
    public function __construct()
    {
        $this->fileUtil = new Dicicip\FileUpload\FileUtil('path-to-file-folder', 'relative-path');
    }
}

public function yourFunction()
{
    $fileInfo = $this->fileUtil->storeBase64ToTemp('[String Base64]', 15);
}

public function yourFunction()
{
    $fileInfo = $this->fileUtil->storeTempFileTo('[relative-path]', '[target-relative-directory]');
}
bash
composer