API page: http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...

Is:

 // Save.
file_save($file);
// Record that the module (in this example, user module) is using the file.
file_usage_add($file, 'user', 'user', $account->uid); 

Does not work for me now. Warnings about files not referenced.

Should be:

// Record that the module (in this example, user module) is using the file.
file_usage_add($file, 'user', 'user', $account->uid);
// Save.
file_save($file); 

That way works all right.

Comments

jhodgdon’s picture

Project: Drupal core » Documentation
Version: 7.x-dev »
Component: documentation » API documentation files
Issue tags: +FAPI reference

Thanks! Moving to the project that contains the Form API reference file.

Mołot’s picture

I created this issue using link at the bottom of documentation page. Project was auto-selected (as well as documentation category) If these links are broken, maybe you should contact the website maintenance team? Unless core is a special case, that is.

jhodgdon’s picture

I am on the website maintenance team. :) We're aware of the issue. There are just a few pages where the link would need to be fixed and we haven't gotten around to fixing it yet, so I just move those few issues manually.

Mołot’s picture

Oh OK, thank you. Glad it was not a mistake on my side. I'll try to watch out reporting on core's documentation next time.