I'd love to get support for Filefield Paths for mm_cck

Right now if you have autorun turned on it breaks filefield paths.
The harvested field regresses back to the regular path directory even though the file has been renamed by filefield_paths.
So if I have a file that should end up as /files/music/[author-name]/[title].wav the harvested field will point to /files/original_file_name.wav resulting in a broken file link.
Strangely it actually encodes the file and stores it properly.. it just screws up the harvested field.

Also media_mover doesn't respect filefield paths for storage in a cck field.

CommentFileSizeAuthor
#12 mm_cck.zip7.13 KBdelykj
#10 snapshot7.png45.46 KBhatsch
#7 mm_cck.diff11.7 KBarthurf

Comments

jordanmagnuson’s picture

+1 For filefield path support.

deciphered’s picture

Marking this issue so I can look into it.

jordanmagnuson’s picture

For me, I have a file that's being moved to S3, and the issue is that, after installing the filefield path module, I can no longer select "Use full Drupal filepath on S3" on the MM configuration page. Rather, I can select it, but the selection is not saved. And so the file is moved to S3 without the filepath.

jordanmagnuson’s picture

Never mind my previous issue: it seems to be working now. Not sure what was going on :o

rthomson’s picture

Any idea what you did or didn't do to make the CCK file field point to the correct place after process and storage?

I'm having similar trouble here and I just can't figure it out. Everything works fine with copying the converted file to the correct tokenized directory/path set by filefield paths but the CCK field ends up pointing to the wrong place causing a broken link, even though the correctly converted file ends up in the correct directory!

I also tried creating a second CCK field just for storing the converted file and that CCK field also exhibits the same problem. The converted file goes to where it's supposed to on the filesystem but the CCK field points to the wrong place.

hatsch’s picture

i'd be also very interested in how you did that.

i am using mm_custom_command for processing
and want to store the files in a cck filefield with a custom filefield path.

the strange thing is that field[0]['filepath'] and field[0]['filename'] have the correct values as specified in the filefield path settings

but the cck generic files display doesn't use the filefield path settings, but displays a link to the files directory and uses the output filename as specified in custom command. but with _0 before the extension. (there is some other issue with the file beeing there two times)

arthurf’s picture

StatusFileSize
new11.7 KB

I dug through this code a bit and it is/still is quite a rats nest. The attached patch is a *completely untested* patch. It's basically an attempt to show a new direction in the code and a cleanup.

delykj’s picture

I will try your patch, but I created a modified mm_cck.module that works for me with FileField Path. If there is any interest I clean the source and post it here.

arthurf’s picture

I'd be thrilled if you have a chance to look at it. I'm going to start testing it once I get my demo site back up, but I'm trying to fix a half dozen other things at the same time too :)

hatsch’s picture

StatusFileSize
new45.46 KB

after applying the patch from #7 media mover still does strange things when using it together with filefield_paths.

i attached a screenshot to explain.

all files (except meta txt) are created by media mover with a custom command
they exist in the filesystem as specified in filefield_paths module
the path is correct as specified in the filefield_paths module
the urls is also correct, the image is shown and procecced by imagecache correctly

the only thing not working correct is the Generic Files Display which has the correct filename from filefield_paths but links to a wrong url with a wrong filename. ( the one specified as [output_file] in mm_custom_command )

bryanb229’s picture

@delykj

Would you mind posting that custom module?

delykj’s picture

Status: Active » Needs review
StatusFileSize
new7.13 KB

Hello,

Please see the attached module that fixes CCK storing bugs and FileField Paths related bugs. (This is updated to the latest 6.x-1.x-dev branch).
I marked my modifications within a "DKJ" ... "END" block.
In my case this works. Please test it, and give back some feedback.

jjjames’s picture

subscribing

mrfelton’s picture

@delykj : Thanks. Testing now.

mrfelton’s picture

Status: Needs review » Needs work

Hmm. didn't work for me

delykj’s picture

What was the error you get?
What is your configuration?

nplus1’s picture

I have a related issue where the file name is not replaced in the first cases but only after saving the node for a second time, see http://drupal.org/node/844368 .

ñull’s picture

Well with delykj's the new module in #12, with or without custom Filefield Path, I still get the error

Type MM CCK
Date Friday, September 24, 2010 - 13:45
User Anonymous
Location http://default/index.php
Referrer
Message Could not save file with field_file_save_file()
Severity error
Hostname 127.0.0.1
Operations

the video folder is as follows:

drwxr-xr-x 2 apache apache 4096 Sep 24 12:59 video

it was created when I added the filefield to the content type. The uploaded file is in that folder, so there is nothing wrong with permissions.

nicksanta’s picture

Media Mover does work with Filefield Paths, but not if you enable Auto Run for that configuration.

I'd really like to help out with this issue but don't have enough time resources to.. For the moment I can do without auto run.

arthurf’s picture

@delykj - thanks for the extensive patch (in the future would you mind using a cvs patch? See: http://drupal.org/patch/create if you're not sure how to do it or ping me- I'd be glad to help)! I've gone through this and I think with two exceptions this should go in if this code is working for people.

First, on:

      //DKJ fix to not double save the data at storage and complete
      /*case 'complete':
      case 'storage':
        return mm_cck_node_save($configuration, $file);*/
      case 'complete':        
        if ($job->complete->module == 'mm_cck')  {
          return mm_cck_node_save($configuration, $file);
        }
      case 'storage':        
        if ($job->storage->module == 'mm_cck')  {
          return mm_cck_node_save($configuration, $file);
        }
      //END

I'm unclear on why you need to check $job here? Were you finding that mm_cck_node_save() was getting called by something else?

On this (line 597):

  //DKJ
  $node->status = true;
  //END

I'd rather not have the node status set unless the configuration calls for it. Is this something you need, or can we roll this into the configuration options?

thanks again

osopolar’s picture

I created an issue for 6.x-2.x-dev version: #1229210: Filefield path support. You may have a look on this and back port it.