I'm practicing some file upload with PHP and I was uploading a file numerous times, so I wanted to make sure I wasn't taking up a lot of space on the server. I had a while loop go over every file in the php tmp directory, and there were 103,988 entries.

Is this more than normal? I had assumed the tmp directory was for files that were automatically deleted after a certain amount of time. Am I supposed to be managing this folder some how?

Part of the reason I ask is because I'm writing an app that takes a users file, changes some things, and serves it back to them. I want the file to be deleted once they leave, but I'm not sure what the best way to do it is. Should I have a folder I put all the files in and use cron to delete files older than a certain time?

有帮助吗?

解决方案

General rule is that you should clean up after yourself whenever possible.

If you aren't sure that you can remove temporary files every time, it is a good idea to have a cron job doing this for you once in a while.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top