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

Uploaded file store/storeAs fails when uploaded file is empty #26808

Closed
mgkprod opened this issue Dec 11, 2018 · 0 comments
Closed

Uploaded file store/storeAs fails when uploaded file is empty #26808

mgkprod opened this issue Dec 11, 2018 · 0 comments

Comments

@mgkprod
Copy link
Contributor

mgkprod commented Dec 11, 2018

  • Laravel Version: 5.7.16
  • PHP Version: 7.2.0 (Windows)

Description:

Using store on an uploaded file fails when you push an empty file (created with touch for example), even with name.extension in the client file name.

$request->file('my_file')->store('public/uploads');

Exception returned :

fopen([...]\storage\app\public/uploads/UBNhJUhG2R2NUc7aLzMcD12bVVPqc1naopTbShv1.): failed to open stream: Permission denied

Digging down, the exception is thrown because of the trailing dot returned by the hashName function, when $this->guessExtension() is null.

Credits to @destinais for the unexpected discovery.

Steps To Reproduce:

  1. Upload an empty file
  2. Use the store/storeAs method
  3. See the returned exception
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

1 participant