The function upload_nodes_upload_form_submit() does not respect token replacements that may be specified in the file field file directory settings. This may be dealt with in one of two ways. Since both work and are single line changes, and I don't personally have a preference for which method should be used, I haven't created a patch but present both options here.

Code to be changed (line 626 of upload_node.module):

  // Check destination
  $destination_dir = $field_info['settings']['uri_scheme'] . '://' .
    trim($field_info_instance['settings']['file_directory'], '/');

Option 1 (inline use of token_replace()):

  // Check destination
  $destination_dir = $field_info['settings']['uri_scheme'] . '://' .
    token_replace(trim($field_info_instance['settings']['file_directory'], '/'));

Option 2 (use file_field_widget_uri() to do the same as Option 1):

 $destination_dir = file_field_widget_uri($field_info, $field_info_instance);

This is a great module, hope to see it released soon!

Comments

pyrollo’s picture

Status: Active » Fixed

Thanks for that issue !

I've chosen the second solution, looks better. And I added a dependency to file module, because of file_field_widget_uri function and and also because that's logical (need file fields to use Upload Nodes).

Changes commited.

Status: Fixed » Closed (fixed)

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