Closed (fixed)
Project:
FileField
Version:
6.x-3.3
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 May 2010 at 20:52 UTC
Updated:
29 May 2011 at 20:13 UTC
I am attempting to update my site from 5.22 to 6.16 and FileField 5.x-2.4 to 6.x-3.3. ( CCK 6.x-2.6 )
The 5x functionality of automatically filling in the Description with the file name appears to be missing. This was really useful for long file names that required a few minor edits (say removing .doc).
Any pointers to which function could restore this - many thanks.
Dont know if this is related, but all descriptions have been replaced by filename, not a good outcome with many hundreds of file uploads.
Comments
Comment #1
brettkan commentedI have trawled this forum for this issue and can find no duplicates, which i find a little odd. Perhaps this is my install only. But it is a serious usability issue for me. If you have 50 files to upload and want to change the description to something slightly different from the file name - it is much better to have the description filled in with the file name before editing and saving the page. (perhaps some regex voodoo might be worth a try)
5x version was perfect, in functionality and usability - How do I get back there in 6x? - pretty please...
Comment #2
brettkan commented.... anybody know how this module works?
Comment #3
brettkan commentedLet me rephrase -
on upgrading from D5 to D6, i have lost the descriptions on hundreds of file uploads. I have also lost images attached to nodes with imagefield (but this is not so serious as there were few enough to rebuild in half a day).
I do not have ninja PHP skills and would appreciate any help from anyone who has any idea of how to recover the situation.
I maintain a hospital site whos users are not very web skilled, continuity on file uploads is a priority. I can solve most layout changes with the theme_filefield_widget (etc) functions, but getting description functionality to be similar to the regular D6 file upload module is beyond me.
I have successfully upgraded to D6 on my local server - the only problem keeping me from going live is filefield. Please give me some pointers if you have a moment.
Thankyou
Comment #4
quicksketchUnfortunately FileField in Drupal 6 does not automatically populate file names as the description, nor is there any UI option to make it do this. Now that FileField has been moved to Drupal 7, this functionality cannot be added to FileField since it won't be added to Drupal 7, which is in code freeze.
So the only solution likely is to use theming to solve the problem, which fortunately is not that difficult to accomplish. You can override theme_filefield_widget_item() in your template.php (as you suggested), and then prepopulate the "description" field with a default value based on the file name like this:
Adding that code to the top of theme_filefield_widget_item() should get you most of the way there.
Unfortunately I know this issue is ancient and not likely to be read, so I'm closing it directly. Please reopen if you have further questions and I'll try to get back in a more timely manner.
Comment #5
brettkan commentedThankyou quickscetch for the reply - i will attempt to implement this fix. I find it a very strange decision to drop this functionality as it would make sense for filefield to function in a similar way to regular drupal fie uploading..
Comment #6
brettkan commentedI can not get this fix to work - with the new code it looks like this in template.php (seems to make no difference at all):
**** any help much appreciated ****
Comment #7
mariagwyn commentedI would love to have this feature as well, so if any help is available on the template overrite, that would be wonderful.
Comment #8
quicksketchCoding support is generally outside the scope of help I provide in the issue queue.
Comment #10
brettkan commentedthat worked for me - thank you quicksketch