User field image deleted next day I have a strange issue with my drupal website. I created a image field to let users upload their own user galleries (like favorite images), this is not the profile image. The field works fine, users can upload their photos without limits, i can show it on each user profile (ex, if uid = 10 upload 3 photos, that 3 photos will appear on user profile with uid = 10, not on all profiles).

Now the issue is, in the next day (after the user upload the user photos), the photos disappear, i checked the file_managed table, and they no longer exist, but the entries on field_data_field_user_gallery exists. I tried to reproduce the error and this is what i do:


I log as user, upload some photos to my profile;
I visit my user profile page and everything work;
I change my computer date to next day;
I check table file_managed and files still exists;
I visit my user profile again, and no images;
I check again file_managed and the previous entries disappear;


Anyone has any suggestion for fixing this? I already tried to create a new image field, tried to put in different directory, but always end with the same :/ .

Thanks everyone for your help.

UPDATE

I did some tests with @arpitr and found new data. The error (image deleted from file_managed) only happens if i am logged in as VIP user (a role that i have on my site), so if i am logged and admin or "normal user" or even without login, the behaviour is correct, i can visit the (vip) user profile without any problems. Only VIP users can add and edit user gallery.

I temporarily found a solution using file_lock module, but i want to know and fix if possible why is this happening only with vip user role logged in.

Any ideas?

Thanks a lot.
Are you sure the files are not temporary? It does sound like the files are being deleted because they are not yet permanent as Jayendra suggests.

Are you handling the file uploads yourself? Like through a custom form, because I've forgotten to save files permanently before, and I remember wasting a lot of time on it figuring it out :)

The temp files are cleaned with cron I believe, so I find it weird that altering your computer date would trigger the issue. They might however also be automatically cleaned up when you try to render an image that's not yet permanent, and that has passed it's 'lifetime'.