HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/awsS3/upload_function.php
<?php
//include_once '/var/www/html/selfanalyse/wp-config.php';
include_once '/var/www/selfanalyse/wp-config.php';
require_once '/var/www/selfanalyse/awsS3/vendor/autoload.php'; 
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;

/* -----------------upload function for image-------------- */	
function uploadToS3($usrId, $key, $file_name, $temp_file_location, $mimeType){
	$credentials = new Aws\Credentials\Credentials("AKIATU377FQG7VMDSZNT" , "dOK744KiglIN7tEa+/SvNz070ZmzJlPVmgInhuE/");
	$s3 = new S3Client([
		'region' => 'ap-south-1',
		'version' => 'latest',
		'credentials' => $credentials,
	]);
	$result = $s3->putObject([
		'Bucket' => 'selfanalyse',
		'Key'    => $usrId.$key.$file_name,
		'SourceFile' => $temp_file_location,
		'ACL'    => 'public-read-write',
		'ContentType' => $mimeType,
	]);
	return $result['@metadata']['statusCode'];
}

/* -----------------delete function for image-------------- */	
	function deleteToS3($usrId, $key, $file_name){
		$credentials = new Aws\Credentials\Credentials("AKIATU377FQG7VMDSZNT" , "dOK744KiglIN7tEa+/SvNz070ZmzJlPVmgInhuE/");
		$s3 = new S3Client([
			'region' => 'ap-south-1',
			'version' => 'latest',
			'credentials' => $credentials,
		]);
		$result = $s3->deleteObject([
			'Bucket' => 'selfanalyse',
			'Key'    => $usrId.$key.$file_name,
		]);
		return $result['@metadata']['statusCode'];
	}

/* -----------------get extension-------------- */
function getExtension($str)
{
	 $i = strrpos($str,".");
	 if (!$i) { return ""; }
	 $l = strlen($str) - $i;
	 $ext = substr($str,$i+1,$l);
	 return $ext;
}


/* -----------------get mimetype-------------- */
function getMimeType($file)
            {
                // MIME types array
                $mimeTypes = array(
                    "ai"        => "application/postscript",
                    "cdr"       => "image/x-cdr",
                    "png"       => "image/png",
					"PNG"       => "image/png",
                    "jpeg"      => "image/jpeg",
					"JPEG"      => "image/jpeg",
                    "jpg"       => "image/jpeg",
					"JPG"       => "image/jpeg",
                    "psd"       => "image/photoshop",
                    "pdf"       => "application/pdf",
					"doc"       => "application/msword",
					"docx"      => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
					"txt"       => "text/plain"
                );

                $extension = end(explode('.', $file));
                return $mimeTypes[$extension]; // return the array value
			}
?>