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

[6.x] Allow absolute file path for Storage::putFileAs() #30918

Merged
merged 3 commits into from Dec 25, 2019
Merged

[6.x] Allow absolute file path for Storage::putFileAs() #30918

merged 3 commits into from Dec 25, 2019

Conversation

SjorsO
Copy link
Contributor

@SjorsO SjorsO commented Dec 24, 2019

Currently, trying to store an absolute file path to storage is inconvenient. As far as I know the easiest way to do it is like this:

Storage::put(
    '/some/path/foo.txt',
    $handle = fopen($filePath, 'r')
);

fclose($handle);

With this PR, you can do the following instead:

Storage::putFileAs('/some/path/', $filePath, 'foo.txt');

I haven't changed Storage::putFile. That method uses the UploadedFile to guess the file extension and generate a random file name. See PR #31040

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

Successfully merging this pull request may close these issues.

None yet

2 participants