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

$file->move() always creates an empty 'index.html' #8395

Closed
dusanbrankov opened this issue Jan 1, 2024 · 2 comments
Closed

$file->move() always creates an empty 'index.html' #8395

dusanbrankov opened this issue Jan 1, 2024 · 2 comments

Comments

@dusanbrankov
Copy link

PHP Version

8.1

CodeIgniter4 Version

4.0

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

MySQL

What happened?

Whenever a file gets uploaded and saved with $file->move(), it doesn't only save the file in the specified directory, but it also creates an empty index.html file, every time.

I found this issue, but appending a slash at the end of the path didn't solve my problem.

Steps to Reproduce

Basically, all I am doing is saving the file with move():

$filename = $file->getRandomName();
$file->move("path/to/uploaddir", $filename);

Expected Output

To just save the file without adding empty, unrelated files.

Anything else?

No response

@dusanbrankov dusanbrankov added the bug Verified issues on the current code behavior or pull requests that will fix them label Jan 1, 2024
@michalsn
Copy link
Member

michalsn commented Jan 2, 2024

This is by design - to increase security if you store files in a publicly accessible directory. It will prevent all files in the directory from being displayed (listed) if the server configuration allows it.

@michalsn michalsn removed the bug Verified issues on the current code behavior or pull requests that will fix them label Jan 2, 2024
@dusanbrankov
Copy link
Author

Oh, I see. I couldn't find that information in the documentation, so I thought it was a bug. Thanks for the clarification, I will close this issue then.

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

2 participants