| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/newusafunding.com/vx/lib/ |
Upload File : |
<?php
function upload_to_amazon($bucket='media.learningcentersupport.com',$file_location='',$file_contents='',$file_contents_link='') {
require_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/aws/aws-autoloader.php');
$s3Client = new Aws\S3\S3Client([
'profile' => 'default',
'region' => 'us-east-1',
'version' => '2006-03-01'
]);
if(empty($bucket)) {
$bucket = 'media.learningcentersupport.com';
}
try {
if(!empty($file_contents_link)) {
$file_contents = file_get_contents($file_contents_link);
}
if(!empty($file_contents)) {
$result = $s3Client->putObject([
'Bucket' => $bucket,
'Key' => $file_location,
'Body' => $file_contents
]);
if(!empty($result['ObjectURL'])) {
return true;
} else {
return false;
}
}
} catch(Exception $e) {
//var_dump($e);
//echo "Couldn't upload file";
return false;
}
}
function copy_from_one_bucket_to_another($bucket='media.learningcentersupport.com',$from_location='',$to_location='') {
require_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/aws-autoloader.php');
$s3Client = new Aws\S3\S3Client([
'profile' => 'default',
'region' => 'us-east-1',
'version' => '2006-03-01'
]);
if(empty($bucket)) {
$bucket = 'media.learningcentersupport.com';
}
try {
$s3Client->copyObject([
'Bucket' => $bucket,
'CopySource' => $bucket.'/'.$from_location,
'Key' => $to_location,
]);
return true;
} catch(Exception $e) {
//echo "Couldn't upload file";
echo $e->getMessage();
return false;
}
}
function delete_amazon_object($bucket='',$location='') {
require_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/aws-autoloader.php');
$s3Client = new Aws\S3\S3Client([
'profile' => 'default',
'region' => 'us-east-1',
'version' => '2006-03-01'
]);
if(empty($bucket)) {
$bucket = 'media.learningcentersupport.com';
}
try {
$s3Client->deleteObject([
'Bucket' => $bucket,
'Key' => $location,
]);
return true;
} catch(Exception $e) {
//echo "Couldn't upload file";
return false;
}
}