Jump to content

Profile Image Issue


ruddie

Recommended Posts

Hello, currently, I got myself a site where you have your own profile and your own 'profile image'. I allow people to upload their own image, and checking my folder, it indeed uploads it correctly.

 

Now the issue starts when you try to delete your image, again - when deleted the image is deleted in the folder.. However, when then uploading a NEW image, it simply displays the old one (While the new one is actually in the folder!?)

 

I figured that if you would close the website, and then load it again - it works correctly (figured this means the old image is still loaded in your temp files or something?) Now I was wondering if you could actually somehow *force* the user to re-download this image when you upload a new one.

 

Thanks for your time! :D

Link to comment
https://forums.phpfreaks.com/topic/227543-profile-image-issue/
Share on other sites

Ah yes.. I hoped that wasn't needed...

Right now I simply named the file the same is the user his username, and changed it every time.

However, I figured I can do it differently like giving it a sort of 'random' value, and store this value in my database, where I can then retrieve it from (Although that seems like an awful lot more work) - but if this is the only (or best) way, I'll do it like this.

Link to comment
https://forums.phpfreaks.com/topic/227543-profile-image-issue/#findComment-1173717
Share on other sites

Ah yes.. I hoped that wasn't needed...

Right now I simply named the file the same is the user his username, and changed it every time.

However, I figured I can do it differently like giving it a sort of 'random' value, and store this value in my database, where I can then retrieve it from (Although that seems like an awful lot more work) - but if this is the only (or best) way, I'll do it like this.

It's the way I'd do it.

a good random value is the user's username or user_id plus the timestamp.

Store the new file name in your user table.

 

I'm not good at dealing with cache issues, so this is how I do it. There may be another way.

Link to comment
https://forums.phpfreaks.com/topic/227543-profile-image-issue/#findComment-1173719
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.