开发者

PHP download file while reading

开发者 https://www.devze.com 2023-04-12 06:22 出处:网络
I have two PHP services. One that let other users to download a file. Another that fetch every some time an updated version of that file.

I have two PHP services. One that let other users to download a file. Another that fetch every some time an updated version of that file. Now I am implementing it through flock(). I thought of improving it by usin开发者_开发技巧g link() - I mean downloading the file and then link to the new downloaded file. But, there is a problem with this way because you cannot link() a file that is already is being link.

Any ideas?


Download the new file to a temporary filename and then move it over to the real filename. No need to deal with links or locks. Your filesystem normally knows what it does.

Just add some error checking and deal with errors.

0

精彩评论

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

关注公众号