开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜