FileField description token not properly defined
tomboone - February 29, 2008 - 17:36
| Project: | FileField |
| Version: | 6.x-3.0-beta3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | scottrigby |
| Status: | closed |
Description
The code defines several tokens for data related to FileField uploads (file name, mime type, etc.), but no token exists for the file description field. Instead, there is a token defined for file title, data that does not exist in FileField. When I attempted to use the file-title token in the Auto Node Title it was blank even though there was a description filled in for the file.

#1
Replacing 'title' with 'description' in token functions appears to fix the problem.
#2
Makes sense. I committed this to CVS (DRUPAL-5--2 branch), should work in the next release.
Thanks for the patch (and the bug report in the first place)!
#3
Automatically closed -- issue fixed for two weeks with no activity.
#4
The same issue seems to be happening with FileField 6.x-3.0-beta3 (& Automatic Nodetitles 6.x-1.1).
Patch against beta3.
In filefield_token.module, on line 32
<?php$tokens['filefield-description'] = isset($item['description']) ? $item['description'] : '';
?>
should be:
<?php$tokens['filefield-description'] = isset($item['data']['description']) ? $item['data']['description'] : '';
?>
because the $item array looks like this:
<?php
Array
(
[fid] => 1
[list] => 1
[data] => Array
(
[description] => Test PDF
)
[uid] => 1
[filename] => test.pdf
[filepath] => sites/default/files/files/test.pdf
[filemime] => application/pdf
[filesize] => 6575
[status] => 1
[timestamp] => 1238010320
)
?>
#5
Thanks scottrigby, you're very right. This seems to have been an issue ever since the 3.x branch of the module which introduced the "data" serialized column. Committed. Thanks!
#6
Automatically closed -- issue fixed for 2 weeks with no activity.