No upload information when we allow multiple values for the file field. I funno what kind of info you'd need if you need some :D.

Keep up the good job.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Hamulus’s picture

same problem in D6
tested on two FF - progressbar not working with multiple values fields

perusio’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Assigned: Unassigned » perusio

I'm having a look at this now. See also: http://drupal.org/node/1842478.

FalkNisius’s picture

All problems for FileField Nginx progress result in the implementation of FileField what not respect additional pathes like x-progress-id, included from nginx progress.

For drupal 7.22 I have following solutions:

The first solution for single filefields (cardinality == 1) is to change the
File: /modules/file/file.module
Function: file_ajax_upload()
The code assumes, that the last part of the formpath is the formbuildid. That isn't correct if widgets added some pathinfo. We can add the progress-id pathinfo in front of the formbuildid and change the nginx.conf to find the progress-id, or we can change the file.module to ignore additional pathes. I choose the second approach and pop the pathparts until one have the form: form-

function file_ajax_upload() {
  $form_parents = func_get_args();
  // DIRTY HACK for FILEUPLOAD Variant: remove x-progress-id
  do {
    $form_build_id = (string) array_pop($form_parents);
  } while  ( ! preg_match("/^form-/i", $form_build_id) );

The second solution for multiple filefields (cardinality > 1) is to change the
File: /modules/file/file.field.inc
Function: file_field_widget_process( $element, &$form_state, $form )
The code flattens the ajax informations and remove the number of the value of the field. For this, the code build a new path without respecting the included x-progress-id. This code has to change. One variant is to punch the value number out of the path, the other is to detect additional x-progress-id and save the progress-id. I choose the second way, because it was easier for me, I think the first approach is the clearer one also for other widgets.

  // Adjust the Ajax settings so that on upload and remove of any individual
  // file, the entire group of file fields is updated together.
  if ($field['cardinality'] != 1) {
    $parents = array_slice($element['#array_parents'], 0, -1);
    $new_path = 'file/ajax/' . implode('/', $parents) . '/' . $form['form_build_id']['#value'];
    $field_element = drupal_array_get_nested_value($form, $parents);
    $new_wrapper = $field_element['#id'] . '-ajax-wrapper';
    foreach (element_children($element) as $key) {
      if (isset($element[$key]['#ajax'])) {
        if ( preg_match('|(/x-progress-id:\d+)$|i',$element[$key]['#ajax']['path'],$parts) )
          $element[$key]['#ajax']['path'] = $new_path . $parts[1];
        else
          $element[$key]['#ajax']['path'] = $new_path;
        $element[$key]['#ajax']['wrapper'] = $new_wrapper;
      }
    }
    unset($element['#prefix'], $element['#suffix']);
  }
Heihachi88’s picture

Perusio, how's progress going on regarding multiple fields?

skylord’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
2.31 KB

Encountered this issue recently... Here is the patch (for 2.3 version). To override data set by "file_field_widget_process" we move all upload button alterations to it's own process handler. Works OK for me.

Kristina Katalinic’s picture

I was actually able to apply patch from #5 to the latest .dev version of filefield_nginx_progress.module and progress bar is working on unlimited value file field.
But I can see some errors in my sites error.log which I am unable to interpret and thus I did not change the issue status. Perhaps someone can interpret these errors? Its perusios nginx configuration I have just set up today and I am not sure everything is working as it should....

2014/09/14 19:06:38 [error] 9401#0: *393 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 1xx.1xx.1xx.64, server: mysite.com, request: "POST /file/ajax/field_photos/und/form-TqYpX2LW3ocKF7Lx2koiEGYR-EOPCuyBRkhp5srOYlY HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "mysite.com", referrer: "http://1xx.1xx.1xx.64/node/65/edit?destination=node"

2014/09/14 19:14:28 [error] 9401#0: *432 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 1xx.1xx.1xx.64, server: mysite.com, request: "GET /node/65/edit?destination=node HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "mysite.com", referrer: "http://mysite.com/"
MustangGB’s picture

Category: Feature request » Bug report
Priority: Normal » Major

This seems like a pretty big wtf, and certainly a bug report rather than a feature request.

MustangGB’s picture

Status: Needs review » Reviewed & tested by the community

Whoops, also meant to add that I've tested and used #5, and it's working as advertised.

ispboy’s picture

The patch is working, thanks!

MustangGB’s picture

Any maintainers around?