Well not "messed" up. They do work, but it splits all files into many separate folders depending on the minutes they were created.

Is it possible to have a token, like [site-yymmdd] that creates a single folder within my files directory like "audio/090501" then "pdf/090501", etc. No minutes or whatever.

I need to have an organized upload path, and the File Paths settings seems so close to what I need.

I know it can be done with some combination of time() and date() PHP functions, however, would it be hard to do in this module? What .INC files handle it?

Thanks

CommentFileSizeAuthor
#6 Picture 3.png44.26 KBquicksketch

Comments

esend7881’s picture

Wow, I just found this http://drupal.org/project/file_aliases

But it is in development mode. Anyone think it is "okay" to put on a commerce web site..?

Or does anyone know what aspects of it are insecure, maybe I could put on my coding gloves and have a look inside..

quicksketch’s picture

Title: The [site-date] File Paths are all messed up! Is there another way? » Put files into date based directory (yymmdd)

They're not "messed up" at all, you just need to use them correctly. You're not limited to using a single token per directory, just put all the existing ones right next to each other like audio/[site-date-yy][site-date-mm][site-date-dd].

esend7881’s picture

Oh, I didn't realize tokens worked like that. So we just say [site-date-yy] and that will give 09?

Thanks a lot!

Is this common drupal knowledge?

quicksketch’s picture

Yep, that's the way it works for any token. Just put in the token placeholder and it will be swapped out for a dynamic value. It's pretty common Drupal knowledge, but not "base-level". Since it requires the token.module, not all sites have this functionality, but at the same time, use of tokens is required for PathAuto module (which is very popular) and token.module itself is the 3rd most installed module from all of drupal.org (http://drupal.org/project/usage), behind only Views and CCK.

esend7881’s picture

Umm..

I just did a test run and used this as my Path:

magazine-files/reference-material/audio/[site-date-yy][site-date-mm][site-date-dd]

And that was the name of the folder.. literally.

I do have Token module enabled.

Is there a step I am missing here?

quicksketch’s picture

StatusFileSize
new44.26 KB

That should be it. You're running 3.0 RC1 (according to the report), so FileField should have token support enabled. When you configure the field, does it list all the available tokens beneath the path settings? If that list of tokens is there (they're there automatically if you have Token enabled), then it should work with the settings you describe. I tested this out again and it works.

esend7881’s picture

Version: 6.x-3.0-rc1 » 6.x-3.0

I am running 3.0, but I'm not sure if it is RC1. It is just the one that you download and recommended to use (released 4/21). I may have mislabeled it.

Does this change things? I dont' see the specific [site-date-yy]. I only see the [site-date] alone.

quicksketch’s picture

The tokens available are dependent on your version of Token.module, not FileField. I'd recommend upgrading your token module and see if that gets you the needed tokens.

esend7881’s picture

I am using the latest stable version of tokens.module 6.x.1.11

This is the list of tokens I can use: http://drupal.org/node/390482

I don't see [site-date-yy] or anything like that.

Are you using a module that extends tokens? If so, which one?

esend7881’s picture

I applied this patch:

http://drupal.org/files/issues/token-date-d5.patch

And it did the trick

Thanks!

quicksketch’s picture

Status: Active » Fixed

Ah, okay. I've been running the development version which already includes this change (see #236596: Add support for date parts YYYY, MM, and DD). Applying the patch as you have done is just fine, since that change will be included in the next version of token module (1.12) when it comes out.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.