public static function uploadFile($file, &$result, $options = []) { $rootTmp = static::getTmpUploadsRoot(); // FileHelper::dirTtlClear( $rootTmp, 3600, [ 'deep' => true ]); $rndKey = StringHelper::rndHex(8); $ex = strtolower($file->getExtension()); $key = "{$rndKey}.{$ex}"; $path = "{$rootTmp}/{$key}"; $file->saveAs($path); $result[$key] = []; if (array_key_exists('cbSave', $options)) { $options['cbSave']($file, $key, $path, $result); } }
public static function getRndKey() { return StringHelper::rndHex(8); }