开发者

Replace image(s) with another image(s) from server

For examples, You can upload profile avatar to your profile. I want to remove the previous one the user had.

So before the query, where it changes the column "avatar" with the newfile2.jpg i would like to get the old file newfile1.jpg, and remove the previou开发者_开发知识库s image from the server.

How can I remove an image from the server?


Well i truly agree with the "Phill", you can use the naming conventions, But you really want to delete then use the unlink command.

$filename = // File name with full path
unlink($filename);

Thanks


You could just use a naming convention. Something like:

<user_id>_avatar.jpg

so when the user uploads the new avatar image it just overwrites the old one.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜