I'm tried this module on Drupal 5.1, but it seems I still encountered problem when I used it. FYI, I've installed and activate UploadPath & Token Module, set the location of uploaded files will be in the UploadPath configuration but still when I upload a file as an attachment, the file was still uploaded to /files/directory.

Comments

michelle’s picture

I just did the same thing and got the same result. I'm using [user-id] for my token.

Michelle

Tom-182’s picture

Title: File still uploaded to /files/ directory » Great module, but..

This is actually a great module that everyone has been waiting for. If only the developer can fix the problem. I only hope this kind of module will be included in the upcoming version of Drupal package.

Crell’s picture

Title: Great module, but.. » File still uploaded to /files/ directory

Please keep the title consistent. Thanks.

I doubt this module will be included in Drupal core. If token module gets integrated then it would make sense, but not otherwise.

As for the bug, can you try other tokens and see if they work? I was originally testing with the global current user as a token. Does that work for you? Is it the user id of the node or the user id of the currently logged in user that doesn't work? Details please. :-)

michelle’s picture

I tried it with [user-name] and it worked but then I had another thought. When I did it with [user-id], it was on a comment so I replied to the post and tried again. Sure enough, it put it straight in /files. So I think the issue may be whether you are uploading to a node or a comment. At least for me. I don't know about for the OP.

Michelle

Tom-182’s picture

I tried using [user-id], and it works. But when I add other tokens into the path e.g [user-id]/[user-id]/[site-date] it didn't work.

I also notice that when the file was uploaded the url in the "File attachments" is still in /files/file-name, but when we submit the node, the url & file location change according to our upload path :).

Tom-182’s picture

Sorry, what I meant was [user-name/[user-id]/[site-date]
Thank you.

michelle’s picture

In my case, the file is still in the wrong place even after submitting. It sounds like we're not having the exact same problem after all. Would it be better if I filed my own issue?

BTW, why did you assign this issue to yourself? It doesn't sound like you're in a position to fix it...

Michelle

Tom-182’s picture

Have you tried using [user-id] token? Coz it worked for me.
This is my first time posting an issue, so I didn't quite understand about the assign feature. Sorry :)

michelle’s picture

Yes, [user-id] is the token I started with and it works on nodes but not comments, as I mentioned above.

Michelle

michelle’s picture

I'm withdrawing from this issue. I'd completely forgotten that attaching files to comments is due to another module, and not part of core. So my issue is with the modules not playing nice together, which has nothing to do with this issue.

Michelle

Crell’s picture

Assigned: Tom-182 » Crell
Status: Active » Fixed

There's a few things going on here.

1) Yes, this module only deals with uploads on nodes, not comments. I didn't even know there was a module to let you do uploads on comments until this thread. :-) That would be a separate feature request.

2) Yes, the Ajax'ed string is wrong. That's because at that point it says where the file "will be going" not where it is yet. I don't know if I can even hook into that process to update it. If it's possible, please file that as a separate issue.

3) Tom: The "Assigned" attribute is for people to step up and flag themselves as the person who will try to fix an issue. You are welcome and encouraged to try and fix the bugs you find, but if you're just reporting them then you probably want to leave it assigned to none. :-)

4) The actual problem here is that the Upload Path wasn't handling multiple directories properly. I thought file_check_directory() did that for me, but it didn't. :-( I've updated the code to handle multiple directory nesting properly and it seems to work in testing.

Committed to 5.x-dev. Thanks folks!

Anonymous’s picture

Status: Fixed » Closed (fixed)