Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Improve the docs on changing permissions/visibility of files #8

Closed
mgallegos opened this issue Feb 3, 2017 · 4 comments
Closed

Improve the docs on changing permissions/visibility of files #8

mgallegos opened this issue Feb 3, 2017 · 4 comments

Comments

@mgallegos
Copy link

The URL obtained by the method getUrl only works if the file is share publicly.

Is it possible to mark a file as public when uploading the file? or is there an alternative to access the file in some other way?

@mgallegos
Copy link
Author

Found it!

$filesystem->setVisibility('secret.txt', 'public');

@zoidyzoidzoid
Copy link
Contributor

We should probably improve the docs

@zoidyzoidzoid zoidyzoidzoid reopened this Nov 30, 2017
@zoidyzoidzoid zoidyzoidzoid changed the title How to publicly share a file Improve the docs on changing permissions/visibility of files Nov 30, 2017
@regiszanandrea
Copy link
Contributor

@zoidbergwill I think this #30 could help :)

@vinay-vissh
Copy link

Following code can 'upload the file as well as make it public" in single request to Google Storage.

// Visibility issue:
// > \Superbalist\LaravelGoogleCloudStorage\GoogleCloudStorageServiceProvider, which is used for Google Storage,
//     does not use the value of 'visibility' for the gs disk in config('filesystems')
// > So, lets just pass this ignored config as 4th argument in Storage::putFileAs()
//
$options = [];

$visibility = config('filesystems.disks.' . config('filesystems.default') . '.visibility');
if( $visibility != null ){
    $options['visibility'] = $visibility;
}

/*$pathUploadedFile =*/ \Storage::putFileAs($location, $file, $fileName, $options);

Slightly bigger version of this reply can be found here.

Using v2.0.0 of this package.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants