开发者

How do I delete a file that's been fopen'd?

开发者 https://www.devze.com 2023-01-09 11:12 出处:网络
I\'m using fopen and it\'s saving to my shared hosts /tmp directory. I fclose it, but the tmp file doesn\'t delete. How can I delete this?

I'm using fopen and it's saving to my shared hosts /tmp directory. I fclose it, but the tmp file doesn't delete. How can I delete this?

PHP5, 开发者_运维百科btw.


Use unlink()

fclose just closes the stream, doesn't do anything to the file itself.


If the file is accessible via $_FILES (which is usually the case for HTTP file uploads), you can use unlink($_FILES['userfile']['tmp_name']) to delete the temporary file. See: POST method uploads

0

精彩评论

暂无评论...
验证码 换一张
取 消