Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Files Permission to Public in Digital Ocean Cloud #26

Closed
irfan0786 opened this issue Nov 12, 2019 · 2 comments
Closed

Change Files Permission to Public in Digital Ocean Cloud #26

irfan0786 opened this issue Nov 12, 2019 · 2 comments
Labels

Comments

@irfan0786
Copy link

Describe the bug
First of all thanks for the library. I'm facing one issue I'm uploading HLS in Digital Ocean Cloud but unfortunately files permission is private. How can I change it ? Please see below my code.

Code


$aws_cloud_upload_options = [
                    'dest' => $s3VideoPath,
                    'ACL'          => 'public-read'
                ];
                
                $to_aws_cloud = [
                    'cloud' => $aws_cloud,
                    'options' => $aws_cloud_upload_options
                ];

$ffmpegHLS = \Streaming\FFMpeg::create($config)
                    ->openFromCloud($from_aws_cloud)
                    ->HLS()
                    ->X264()
                    ->addRepresentation($rep_360)
                    ->addRepresentation($rep_480)
                    ->setHlsTime(5)
                    ->setHlsAllowCache(false);
                    $metadata = $ffmpegHLS->save(null, $to_aws_cloud);
@aminyazdanpanah
Copy link
Member

I have never worked with Digital Ocean Cloud or DigitalOcean API, so I do not know how to change the permission files, sorry. I suggest you contact them to help with that.

If you mean Amazon S3 (as your variable name is $aws), then you can set the ACL param to change the permission files to the public.

If you have any problem with running your code please post your cloud class($aws_cloud) code here.

@irfan0786
Copy link
Author

Thanks for the quick response, I fixed it. Modified uploadDirectory Function.

Updated Code

public function uploadDirectory(string $dir, array $options): void
    {
        $dest = $options['dest'];

        try {
            $manager = new Transfer($this->s3, $dir, $dest, array(
                'concurrency' => 20,
                'debug'       => false,
                'before' => function (\Aws\Command $command) {
                    $command['ACL'] = 'public-read';
                }
            ));
            $manager->transfer();
        } catch (S3Exception $e) {
            throw new RuntimeException("There was an error downloading the file.\n error: " . $e->getMessage(), $e->getCode(), $e);
        }
    }

@lock lock bot locked and limited conversation to collaborators Dec 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants