1

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.

  • I think, the status of files in file_managed table is 0 which mean these are temporary files. Please check your file_managed table after uploading images. – Jayendra Kainthola Oct 22 '13 at 10:03
  • Thanks for your reply @Jayendra Kainthola, i just tested again and checked the file_managed and status is = 1, so i think its not that. – Mambley Oct 22 '13 at 10:41
0

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'.

  • Thanks @Vodde for your reply. I am using a normal drupal form, in the page--user.tpl.php i use print render( $page['content']['system_main']['field_vip_gallery'] ); . After i upload the photos i check the file_managed table and status is = 1, so i think its okay, or no? I am new on Drupal, how can i check if the files are permanent or not? About the cron, i did that before too, run the cron (before try to change the computer date) but running the cron doesn't produce the error. The error just happens in the next day, that's why i tried to change the date. Any suggestions? Thanks again. – Mambley Oct 23 '13 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.