I need to have an extended filefield that lets me add data fields and store their values in their own db columns, so I can then filter a view based on these values.

Is there any way to do this in the current implementation of filefield? I have figured out how to create my own 'combo' widget in a module, but I don't know how to intercept the data being saved and store it in my own structure, since the files are uploaded with AHAH independently of the overall node form submit.

CommentFileSizeAuthor
#6 filefield_exif.tar_.gz4.22 KBkdebaas

Comments

quicksketch’s picture

As far as I know, it is not possible to extend FileField to do this. What you are asking is really a more general CCK question about combining any multiple fields. The CCK 3 branch (in CVS only as far as I know) supports the concept of "multigroups" in which you can combine multiple fields together and have the "Add another item" button affect all of them at the same time, but unfortunately this functionality didn't make it in Drupal 7, so now they're not sure what to do with it. Another approach is to simply make a different table, then join to it from Views and do your sorts that way, such as the way FileField Meta provides meta data to views like ID3 tags. The data doesn't necessarily need to be in the same table for you to sort on it, it would just be more efficient if it were.

justageek’s picture

Thanks for your reply. I had thought about that, and I'll check out the filefield meta module, my biggest thing is , now that I have figured out how to combine my new text field with filefield, i need to:

1. tell filefield to do its normal stuff during render, save, etc.
2. also tell drupal to save my text value in my new table.

I think I'm close just have not quite got there yet.

nevets’s picture

See Imagefield extended which starting with the 6.x-4.x branch also extends file field.

quicksketch’s picture

Thanks nevets, I hadn't known that, but since it will have to do that in Drupal 7, good to see there's a jump start in the Drupal 6 version.

quicksketch’s picture

Status: Active » Fixed
kdebaas’s picture

StatusFileSize
new4.22 KB

Another solution is to look at how filefield_meta does this. Yesterday I adapted the code from this module to create my own which would retrieve specific exif data from imagefields and store it in a database table. The exif fields can be displayed in views lists. The module is attached, have a look at the code. It is a work in progress though, and I may not be aware of any mistakes I have made yet.

(You may have to rename the file to filefield_exif.tar.gz after downloading, since on upload I got this message: For security reasons, your upload has been renamed to filefield_exif.tar_.gz.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.