Closed (won't fix)
Project:
Comment Upload
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Apr 2007 at 04:16 UTC
Updated:
7 Aug 2010 at 21:54 UTC
Jump to comment: Most recent file
Comments
Comment #1
Christefano-oldaccount commentedI'd like this.
subscribing.
Comment #2
heine commentedSo do I. With http://drupal.org/node/136630 committed this can be implemented. Can't make promises on a time frame. Patches are always welcome.
Comment #3
Mac Clemmens commentedAmen. This feature would be most useful. Let me know if/how I can help. :)
Comment #4
heine commentedPatch against 5.x-dev. It suffers from the same limitation as upload_path on node previews.
Comment #5
Christefano-oldaccount commentedThis works for the most part but it looks like attachments on comments cannot use tokens like
[nid]or[ogname]. I hesitate to change status to needs work because I don't know if this is a bug in Upload path or Comment Upload.Comment #6
heine commentedNo longer requires upload_path module.
We need two settings pages, because the comment_upload prefix needs its info from comment tokens, whereas the node uploads needs it from node tokens. We cannot use one variable for that.
Comment #7
Christefano-oldaccount commentedThe patch looks solid to me and works as advertised. Thanks, Heine!
Comment #8
heine commentedneed to solve preview issue first (files/filename instead of files/token/filename)
Comment #9
Mac Clemmens commentedAny update here? I see previews in now working with the dev release -- nice work. Can this patch still be applied, and will it be committed?
Let me know if/how I can help.
Thanks,
Mac
Comment #10
Mac Clemmens commentedIs it possible to allow users to enter node tokens as well as comment tokens? (Like they do for file upload paths.) This would be very useful to ensure that files that are uploaded in comments end up in the same place as other files uploaded with the node.
Great patch work -- thanks!
Mac
+function comment_upload_change_upload_path(&$comment) {
+ $node = node_load($comment['nid']);
+ if (isset($comment['files'])) {
+ foreach ($comment['files'] as $key => $file) {
+ if (0 === strpos($key, 'upload_')) { // Only rewrite the name when adding the file, not when updating it
+ // Get the new, prefixed file name
+ $file_name = str_replace(array(' ', "\n", "\t"), '_', token_replace(variable_get('comment_uploadpath_prefix', '') . '/', 'comment', $comment)) . $comment['files'][$key]['filename'];
+
+ // Create the directory if it doesn't exist yet.
+ $dirs = explode('/', dirname($file_name));
+ $directory = file_directory_path();
+ while (count($dirs)) {
+ $directory .= '/' . array_shift($dirs);
+ file_check_directory($directory, FILE_CREATE_DIRECTORY);
+ }
+ // Change where the file will be saved to the specified directory.
+ $comment['files'][$key]['filename'] = $file_name;
+ }
+ }
+ }
+}
Comment #11
korvus commentedI'm interested in seeing this implemented as well. Has there been any progress?
Comment #12
Babalu commenteda d6 version of the patch would be great
Comment #13
CobraMP commentedbump. I am looking for a upload path. [title] preferably. casting my vote
Comment #14
heine commentedYou can vote all you want, but this is not a democracy.
I am no longer interested in this; I don't need this functionality, none of my clients need it (atm) and as far as I know, Drupal.org doesn't need this either. Long story short: unless you have a good patch and got it tested, don't bother bumping.
Comment #15
Libra commentedI create small patch for 6.x-1.x-dev version, which add upload path field (with token placeholders) to comment_upload settings and use this path for upload files.
Unfortunately, we can't use for 6.x version token placeholders for node object, because node object not accessible in comment_upload_process_files function.
Comment #16
elijah lynnI vote for this too!
I was trying to use IMCE to upload files through comments but that seems unlikely, if upload_path can work with comment_upload then at least all the files the user does upload through tinymce/imce will go into the same directory as the files uploaded from comment_upload and upload modules.
Then they can use the file_browser in my_account and see all the files they have uploaded. Then when I finally figure out how to upload files with IMCE through comments they can re-use files.
Comment #17
michelleIf folks are really interested in this, you might want to set it active to get the attention of the current mantainer. I started the issue 2 years ago but am no longer interested. I am converting my site to all nodecomment / imagefield and not using the comment module anymore.
Michelle
Comment #18
that0n3guy commentedJust so everyone knows... filefield path module works with comment upload.
Comment #19
ilw commentedThanks!