Rename file uploads using other form fields
sunahsuh - January 27, 2009 - 01:33
| Project: | Webform |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | file, renaming, uploading |
Jump to:
Description
It would be really helpful if I could rename file uploads with information from other form fields -- i.e. if the form has basic personal info plus a file upload for a headshot, the file would be renamed something like LastName_FirstName.

#1
This would also solve collision errors where users overwrite each other's files in the directory if they have the same filename -- for instance, a filename like resume.doc is quite common for a resume upload.
#2
This is very unlikely to be implemented. If needing complex renaming of files, you'll need to create a custom module to handle it. You might take a look at how Transliteration module cleans up the names of files on upload.
#3
This would be a very helpful module, I am currently working on some hack-job version of it, if anyone can implement, 100 kudos
#4
File upload collisions are already solved by Drupal. If two items with the same name are uploaded, the second one gets "resume_0.doc", then "resume_1.doc", etc.
#5
Another good feature would be automatic naming according to predefined pattern. For example,
User file: A very long and ugly filename.doc
Rename mask = file-xxxx.doc, automatic counter = on
Resulting file: file-0001.doc
Who's first to implement? :)
#6
You could create this with CCK, Token and File field. I have it setup, so when uploading an attachment to a node, the file is renamed to the-title-of-the-node.ext.
I needed this because people kept uploading files that contained spaces, &*()%$#@!/ in their filenames. Now I have nice clean url's that also match the posts title.
#7
You should simply install Transliteration module to fix this particular problem.
#8
I know, but I also wanted to order all uploads in a nice structure. Giving them a place related to the post type and title.
But you're right, If I'd only wanted to cleanup there's an easier way.
#9
@fivehimself: Could you please detail how you did this? It's exactly what I need to do!
#10
Nevermind, I was able to take care of my issue using http://drupal.org/project/filefield_paths
#11
fivehimself and avolkman .... did you get this to work on a webform?
I've used filefield_path to control attachments to nodes but I can't see how to use it for the webform file component.
(and I can't see how to get either core attachments or a CCK filefield working with a webform)
#12
I didn't use webform.... so I can't help you with that.
#13
Subscribing. I would also find this feature useful.
#14
Subscribing
#15
I didn't use webform either :-/