Closed (won't fix)
Project:
Webform
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Jan 2009 at 01:33 UTC
Updated:
4 Mar 2012 at 07:54 UTC
Jump to comment: Most recent
Comments
Comment #1
sunahsuh commentedThis 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.
Comment #2
quicksketchThis 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.
Comment #3
charles_wisniewski commentedThis would be a very helpful module, I am currently working on some hack-job version of it, if anyone can implement, 100 kudos
Comment #4
quicksketchFile 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.
Comment #5
lex0r commentedAnother 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? :)
Comment #6
fivehimself commentedYou 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.
Comment #7
quicksketchYou should simply install Transliteration module to fix this particular problem.
Comment #8
fivehimself commentedI 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.
Comment #9
albert volkman commented@fivehimself: Could you please detail how you did this? It's exactly what I need to do!
Comment #10
albert volkman commentedNevermind, I was able to take care of my issue using http://drupal.org/project/filefield_paths
Comment #11
chorrylan commentedfivehimself 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)
Comment #12
fivehimself commentedI didn't use webform.... so I can't help you with that.
Comment #13
seattlehimay commentedSubscribing. I would also find this feature useful.
Comment #14
lukusSubscribing
Comment #15
albert volkman commentedI didn't use webform either :-/
Comment #16
mrfelton commentedI think this would be a useful addition to webform too. Use case:
Webform is being used to submit entries to a competition. For each entry there is an attached file which needs to be renamed on upload to include the submission id (sid) in the filename. This makes it much easier to administer the submissions.
Comment #17
mossill commentedthank you @Albert Volkman. This module is what I was looking 4. peace !
Comment #18
boftx commentedSubscribing.
One approach might be to allow the use of tokens in the path field. For my purposes, it would be very helpful to place uploads in a directory structure based on UID and NID. This would reduce directory size and clutter.
Comment #19
michelleI need this as well. Anyone come up with anything in the last 4 months?
Michelle
Comment #20
michelleOk, Quicksketch's mention of the Transliteration module was the key here. If anyone is looking to do this, here's what I did:
$_POST['submitted']contains all the other stuff on the form. That custom module just uses that to created a new filename and sends it back.The first line checks for the existence of "category" which lets me know this is the file I'm interested in.
If you use Transliteration, make sure you weight your site module higher or it will make changes to your adjusted file name.
This has had only minimal testing so far as I just finished it 5 minutes ago. Be sure to do your own testing.
Michelle
Comment #21
scott m. sanders commentedSubscribing
Comment #22
kim.pepperJust installing the transliteration module helped me with an issue of double encoded spaces.
Comment #23
quicksketchPer #2.
Comment #24
oliverpolden commentedI realise this is old but for anyone coming across this there is extra stuff you can do if you have the entity module. It includes the entity tokens module so you can do stuff like renaming an image file with the alt text.