I'm curious about this piece of code in upload_js() in the upload module:

  if(!empty($form_state['values']['files'])) {
    foreach ($form_state['values']['files'] as $fid => $file) {
      if (isset($cached_form['#node']->files[$fid])) {
	$files[$fid] = $cached_form['#node']->files[$fid];
      }
    }
  }
  $node = $cached_form['#node'];
  $node->files = $files;

What does this do, exactly? Since just before this we call upload_node_form_submit() which adds the most recently attached file to the node thus:

    $form['#node']->files[$file->fid] = $file;

The block of code in upload_js seems redundant to me, but obviously I'm missing something.

This is in no way a bug report, I'm just looking for a little education, so if somebody can take a stab at explaining what is going on here to me, I will appreciate it!

Comments

dpearcefl’s picture

Did you ever get your answer?

kars-t’s picture

Status: Active » Fixed

Hi

I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.

Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.

Status: Fixed » Closed (fixed)
Issue tags: -upload.module core

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