A certain content-type in my installation does not save images in it's gallery anymore.

The image is being uploaded, registered in file_managed with status 0, and stored in sites/default/files.

On save the status does not get updated to 1 in the database, therefore the file gets deleted.

I entered some debug code, and it turns out that file_field_presave() never even gets called for the uploaded file.

Curiously on my testing copy of the same system it works, the function gets called and the status is updated to 1 in the database.

I compared the content-type and field-type settings, and they are the same.

I also compared all drupal-files again (diff -r), except for database configuration ant .htaccess they are the same.

update.php doesn't do any update, and the modules have no security updates pending.

How could I debug the problem? I don't know how to look deeper. Is it possible that the database is somehow inconsintent?

Thanks a bunch for your help people.

  • Sounds like it might be a permissions issue since it involves putting new files in the filesystem and it's different on two otherwise similar systems. – beth Dec 18 '14 at 19:31
  • thanks for the tip. permissions in the file system? I checked that, the uploaded files are already stored in sites/default/files until one clicks save. – Andy Dec 19 '14 at 14:34
  • @betherwisser are there issues if Drupal only has group ownership on the files? – Andy Dec 19 '14 at 14:53
  • I don't know. If you've checked that the files are being saved in the filesystem, that seems like it's not likely to be the problem. – beth Dec 19 '14 at 16:33
  • 1
    So I found differences in the table field_config_instance for a configuration of this field collection. I copied the data field from the testing database to the live database. Now I can upload images for newly created entries in the gallery. (: – Andy Jan 9 '15 at 11:09

Why don't you run a diff on the SQL dump from each database. This will help identify any inconsistencies in the database configuration that you were looking for.

  • because it's a testing vs a live system, 10 months of content are missing in the testing system /: – Andy Jan 5 '15 at 8:08
  • Could you give a hint on which tables to check in particular? I saw some differences in field_config_instance which sounds promising, but deleting the differences didn't change anything. – Andy Jan 8 '15 at 14:38
  • 1
    I would look at the file_managed and file_usage tables. And here's another thing to try. Dump the SQL before and after a file upload on both sites (live and dev). Run the diff on each site's resulting SQL to what changed in dev, and what changed in live. – ben.hamelin Jan 8 '15 at 15:46
  • Well difference is that when uploading the Image, in file_managed on testing status=1, on live status=0. Accordingly, in file_usage after Save there is an entry on testing, but not on live, where also the entry in file_managed gets deleted. That is the expected behaviour when file_field_presave() doesn't get called. Question is why it doesn't. /: – Andy Jan 8 '15 at 15:59

Test if your files are getting deleted if, when editing the node, you also create a new revision.

I had this problem consistently in quite a similar setup (and still do, and haven't solved it). But checking 'new revision' seems to help. And might be a clue.

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.