hello everyone. i've been having an issue where i cannot add a file to a node via imce browser. I create new content, click File Browser, Browse, select my file, click insert and the progress bar appears for a split second and disappears leaving me back as if i'm about to add a file again.

I have created a brand new Drupal 7.29 insatllation on my localhost and installed IMCE and FileField Source. This issue still happens. All the file permissions look right. Drupal permissions look right. IMCE profiles are correct.

Any help at all would be greatly appreciated! Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ias_nickhelm’s picture

Title: Unable to reference file » Drupal 7.29 Breaks FileField Sources
Category: Support request » Bug report
Priority: Major » Critical

Some further troubleshooting led me to downgrade Drupal Core to 7.28. Once core was downgraded, FileField Sources started working correctly again. Unfortunately i'm unfamiliar with the File module code in core and FileField Sources so it may take me a while to figure out a fix, however, here's the link to the patch notes for Drupal 7.29. https://www.drupal.org/drupal-7.29-release-notes

ste.pb93’s picture

I'm also experiencing this issue (which also applies to IMCE for FileField) and have replicated the issue on a fresh drupal 7.29 install.

ias_nickhelm’s picture

This issue seems to be fixed with the release of Drupal Core 7.30

skilip’s picture

Still seems to be broken in 7.31.

fabianvdbor’s picture

I provided a patch that fixes this bug. It checks in hook_file_download if url is external and access to the file with drupal_http_request(). After the check it returns the header information from drupal_http_request() back to the function file_download_headers().

Dean Clayton’s picture

not sure if related, but using the imce file browser, on selecting a file , Chrome crashes ( with the dark blue "oh snap" page)
I don't have this issue in firefox, but the thumbnail is broken.
I tried adding the patch above, but it didn't make any difference.

I'm running 7.31 and i'm on PHP 5.4.3

LonitaD’s picture

Chrome was crashing for me too in 7.31. The patch in #5 fixed the issue.

batigol’s picture

I can confirm the issue.

decibel.places’s picture

While debugging the problem in Drupal 7.31 (I did not try 7.32) prior to discovering this issue and rolling back core to 7.28, I found that the fid is not passed to filefield_sources.module in the $form_state.

The patch in #5 did not help, in fact caused an error message. Perhaps because I am storing image files in Amazon S3 and that required a small patch to rewrite the file uri with the s3:// scheme to match the uri in the file_managed table so that the file validated in imce.inc #2359797: filefield_sources imce correct uri to return a valid fid from file_managed table for images hosted on Amazon s3

Adding the correct fid for the specific file enabled the display of the image when the IMCE browser is dismissed after selecting an image.

I was unable to discover why it was not added to $form_state.

I suspect that changes in the core image module may be causing the problem, because it is called when the file is an image for certain validation functions; it may not be passing the fid back to Filefield Sources.

Therefore we may need to add the fid before the function filefield_sources_field_submit function.

See the last 3 lines below:

function filefield_sources_field_submit(&$form, &$form_state) {

  $parents = array_slice($form_state['triggering_element']['#array_parents'], 0, -3);
  $element = drupal_array_get_nested_value($form, $parents);
  $field_name = $element['#field_name'];
  $langcode = $element['#language'];

  // Get exisitng file values.
  // File Field items are stored in the field state after ajax reloads starting
  // from Drupal 7.8. We try to support all releases by merging the items.
  $field_state = field_form_get_state($element['#field_parents'], $field_name, $langcode, $form_state);  

  //the fid is missing; adding it fixes the problem
  //$form_state['values']['field_imce_inage']['und'][0]['fid'] = 27;
  dsm('filefield_sources $form_state values'); dpm($form_state['values']);
profak’s picture

Status: Active » Closed (duplicate)

Issue solved here #2466247. Closing.