Hi,
When a file is uploaded, it is renamed after the title of the node. If a name clash occurs, then it suffixed with the ID of the node. I believe it would be great to add a form where we could change this behavior. In my case for example, I prefer renaming the files directly after the ID of the node and avoid using the title.
Best regards.
K.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | modified_files.zip | 5.39 KB | Korchkidu |
Comments
Comment #1
Korchkidu commentedHi,
I made some small changes to allow users to choose between different file renaming patterns (none, NodeTitle[_NodeId] or NodeId only). However, I am only a Drupal beginner so I am far from being sure that my changes are ok. So, if someone is ok to check if everthing is ok and merge them is the official version, it would be cool. My changes are easy to locate because they are surrounded by:
// BEGIN CHANGES: K. 2009.10.03
[code]
// END CHANGES: K. 2009.10.03
See modified files in attachments
Best regards.
K.
Comment #2
jbrodbeck commentedI'll try to review in the next couple days.
Comment #3
syndicateStorm commentedLooks great Korchkidu. I tried each of the cases and they seemed to work. This is definitely better than what was in there previously. I'm adding your changes to my version of mp_file. I'll let you know if I run into any problems. Thanks.
Comment #4
Korchkidu commentedThanks for your review.
K.
Comment #5
keereelsyndicateStorm, where is "your version of mp_file"?
Comment #6
syndicateStorm commentedHi keereel,
The last mp_file I posted was on the Ubercart Marketplace 6.x thread. I saw you on there so I'm sure you've already found that.
The one posted there doesn't include this fix. You should have all the source code at your fingertips to make the change though.
mp_file is pending inclusion in the Ubercart Marketplace 6.x module, so we should probably wait for the maintainers to put this all together. Besides I have other changes in "my version" which are in progress. If you have problems integrating the code let me know, I'm happy to help.
Comment #7
keereelThere is one thing that it is desirable that when renaming. The fact is that the renaming only supports the English language. Right, that the files should be called only in Latin letters, but the node may be called and in Russian, as well as the node author. (in my case; in general, I am thinking of other languages). It is highly desirable, when you rename the file, convert the string (for example, using the module http://drupal.org/project/transliteration, which is used to pathauto).
Comment #8
syndicateStorm commentedSee the latest 6.x dev release. There is a new hook, hook_mpf_new_file_name (maybe we should change the hook name...), available so you can name files however you please.
@keereel, I believe you have opened a new issue regarding transliteration (http://drupal.org/node/650122). If this hook fixes your issue please post accordingly so I can close out that issue as well.
P.S. Several simultaneous changes/features were committed to mp_file, so there is some chance mp_file will need a short time to stabilize. If you do run into a bug or this feature isn't working exactly as expect, please respond.