How can I delete local files automatically after being uploaded to the digital ocean? which code should I add to do that automatically?

zeer

Member
Registered
Joined
Feb 12, 2023
Messages
8
Points
3

Reputation:

Hello ENXF I have my own forum where users upload files and etc, especially as an admin, I will really appreciate it if a user would guide me on how this

Amazon S3 for XenForo 2.3.0 add-on​

I USE DIGITAL OCEAN S3 BUCKETS

I have also done all configurations for my bucket on my config.php

My problem is I use shared hosting and set up of S3cmd it cant be done. I just needed my uploaded data to be deleted automatically from my hosting once i have uploaded a file or a user has uploaded it. only files, profile pictures, and any shared files.


and this is my code




$s3 = function()
{
return new \Aws\S3\S3Client([
'credentials' => [
'key' => '...........................',
'secret' => '..............................................'
],
'region' => '.....................',
'version' => 'latest',
'endpoint' => '..............................'
]);
};

$config['fsAdapters']['data'] = function() use($s3)
{
return new \League\Flysystem\AwsS3v3\AwsS3Adapter($s3(), '.......................', 'data');
};

PHP:
$config['externalDataUrl'] = function($externalPath, $canonical)
{
return 'https://......................................................................./data/' . $externalPath;
};

$config['fsAdapters']['internal-data'] = function() use($s3)
{
return new \League\Flysystem\AwsS3v3\AwsS3Adapter($s3(), '..........................', 'internal_data');
};
 
Top