I am currently trying to inject a value and file into a user field called "field_user_pdf".

I am adding values to the following tables which is successful initally:


The user is then able to see the file on their user profile. The user does not have permission to add/edit the file themselves, only an admin does, using the field_permissions module.

However if they edit and save their profile, all record of the file is deleted from the database.

This behaviour does NOT occur if the file was added to the user by an admin in the CMS, it only occurs when the file is inserted in MySQL by circumventing Drupal.

I have come to the above tables by both scrutinizing MySQL Insert logs as well as MySQL Database Dump diffs before and after.

Is there a table or column I am overlooking? Is there any where I can view the SQL Schema for inserting SQL for file fields?

  • Why are you trying to do it this way? Can you use hook_user_insert() and hook_user_update()?
    – keithm
    Commented Nov 8, 2011 at 10:20
  • It's an external service that needs access to the Drupal backend in order to inserts file into the site. It extracts user information, compiles a PDF and then the idea is to associate that PDF back with the user. The external service is written in Python and so we're trying to glue the 2 services together, and figured the common ground is MySQL
    – DanH
    Commented Nov 9, 2011 at 10:05

1 Answer 1


What you are doing, sorry, is plain wrong. There is a field API and you should use it instead of messing around with the SQL tables. If you are going around the field API and it breaks, you truly get to keep both parts. I find it astonishing you expect support for going around such a complex API.

  • I understand the horror of the situation, unfortunately it's an external service written in a different language (python) that needs to insert values into a drupal site. This marriage is also throw away so quick-and-dirty is the order of the day.
    – DanH
    Commented Nov 9, 2011 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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