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

Get infomration about uploaded file when using Laravel #72

Closed
foremtehan opened this issue Jun 18, 2022 · 4 comments
Closed

Get infomration about uploaded file when using Laravel #72

foremtehan opened this issue Jun 18, 2022 · 4 comments

Comments

@foremtehan
Copy link

foremtehan commented Jun 18, 2022

When uploading some file with Laravel like so:

Storage::disk('google')->writeStream('composer.json', fopen('composer.json', 'r')) // true

The output of writeStream is boolean, Is there another method that get more information about uploaded file ?

like file_id, created_at etc ... ?

masbug/flysystem-google-drive-ext: 2.1
laravel 9

@erikn69
Copy link
Contributor

erikn69 commented Jun 18, 2022

getAdapter getMetatada

@foremtehan
Copy link
Author

So it should be 2 requests right ?

$path = 'composer.json';

Storage::disk('google')->writeStream('composer.json', fopen($path, 'r'));

Storage::disk('google')->getAdapter()->getMetadata($path); 

The upload can return the metadata directly and in one request, But unfortunately it's not public method:

protected function upload($path, $contents, Config $config, $updating = null)

@oxytoxin
Copy link

did you somehow find a workaround for this? I also needed the id and would prefer it in one request.

@foremtehan
Copy link
Author

No

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

No branches or pull requests

3 participants