'latest', 'region' => 'ru-1', 'endpoint' => 'https://s3.twcstorage.ru', 'use_path_style_endpoint' => true, 'credentials' => [ 'key' => EnvLoader::getRequired('S3_ACCESS_KEY'), 'secret' => EnvLoader::getRequired('S3_SECRET_KEY') ], 'suppress_php_deprecation_warning' => true ]); $bucket = 'f9825c87-4e3558f6-f9b6-405c-ad3d-d1535c49b61c'; // КЛЮЧ: Минимальные параметры = правильная подпись! $cmd = $s3Client->getCommand('GetObject', [ 'Bucket' => $bucket, 'Key' => $s3Key ]); $request = $s3Client->createPresignedRequest($cmd, "+{$expirationSeconds} seconds"); return (string)$request->getUri(); } catch (Exception $e) { error_log("Pre-signed URL error: " . $e->getMessage()); return null; } } function getContentType($filename) { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); $types = [ 'doc' => 'application/msword', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'xls' => 'application/vnd.ms-excel', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'ppt' => 'application/vnd.ms-powerpoint', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation' ]; return $types[$ext] ?? 'application/octet-stream'; } ?>