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
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

sunahsuh - January 27, 2009 - 01:53

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

quicksketch - January 29, 2009 - 19:45

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

charles_wisniewski - February 2, 2009 - 14:32

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

quicksketch - February 14, 2009 - 04:11

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

lex0r - February 19, 2009 - 10:45

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

fivehimself - April 16, 2009 - 10:54

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

quicksketch - April 16, 2009 - 19:10

I needed this because people kept uploading files that contained spaces, &*()%$#@!/ in their filenames.

You should simply install Transliteration module to fix this particular problem.

#8

fivehimself - April 20, 2009 - 16:47

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

Albert Volkman - May 15, 2009 - 19:55
Version:» 6.x-3.x-dev

@fivehimself: Could you please detail how you did this? It's exactly what I need to do!

#10

Albert Volkman - May 18, 2009 - 20:53

Nevermind, I was able to take care of my issue using http://drupal.org/project/filefield_paths

#11

chorrylan - July 25, 2009 - 08:44

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

fivehimself - July 25, 2009 - 14:23

I didn't use webform.... so I can't help you with that.

#13

seattlehimay - October 23, 2009 - 22:18

Subscribing. I would also find this feature useful.

#14

lukus - November 2, 2009 - 16:19

Subscribing

#15

Albert Volkman - November 9, 2009 - 16:47

I didn't use webform either :-/

 
 

Drupal is a registered trademark of Dries Buytaert.