After upgrading to latest core 7.36, adding a file from IMCE file browser source doesn't work as expected. It seems that it's broken only if cardinality of field is one. When you allow more than one files to be uploaded (cardinality of field >1) everything is ok. I tested it against 7.35 and it works fine. Is anyone else affected by this?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

demandajmenso’s picture

This is the core commit that breaks imce filefield source plugin
https://www.drupal.org/node/1734716

demandajmenso’s picture

Here is a patch.

demandajmenso’s picture

Status: Active » Needs review
David_Rothstein’s picture

Title: drupal core 7.36 broke imce upload » Drupal core 7.36 broke filefield source Ajax uploads

This happens for other options too, e.g. "Remote URL" (see #2465973: Image upload from url is not working properly).

Caused by #1734716: File field form label has incorrect id in @for attribute, apparently.

David_Rothstein’s picture

As far as I can see, the Ajax uploads break (meaning you don't get the nice file preview) but it still works after you submit the form.

David_Rothstein’s picture

Title: Drupal core 7.36 broke filefield source Ajax uploads » Drupal core 7.36 broke filefield source Ajax upload previews
David_Rothstein’s picture

Similar issue in another module.

David_Rothstein’s picture

Title: Drupal core 7.36 broke filefield source Ajax upload previews » Drupal core 7.36 broke Filefield Sources Ajax upload previews
Version: 7.x-1.9 » 7.x-1.x-dev
FileSize
3 KB

Here's a relatively simple approach that should fix all of them. (I've only tested it on the IMCE browser and Remote URL options, though.)

Basically, just change the code so that it uses the actual Ajax wrapper rather than assuming a particular relationship between the element ID and wrapper ID.

demandajmenso’s picture

Nice.
Patch #8 offers a better all around solution.

Chris Burge’s picture

Patch #8 tests successfully for me.

vissutovega’s picture

@david rothstein,

I tried your patch for Filefield Sources Ajax after updating to drupal 7.36 broke the preview functionality but it still doesn't work. it throws a 500 internal server error on click. Is there something I'm missing here? I've updated all 5 .inc files

Alternatively even on regular image file fields without file browser, it fails to upload the ajax thumbnail preview and also throws the same 500 internal server error in console

juanjo_vlc’s picture

The patch at #8 worked for me.
Thanks @David_Rothstein

aitala’s picture

Patch #8 worked for me...

Thanks!

partdigital’s picture

I can confirm that the patch in #8 worked for me.
Tested it on a stand-alone file upload field.

uno’s picture

#8 solves preview problem for me.

TY

hobbes_VT’s picture

Had the same issue with "Remote URL" - #8 fixed it.
However, I'm using elFinder instead of IMCE, there the issue still exists.
Probably need to look into where elFinder integrated into the filefield_source module.

Found it - elfinder has it's own sub module to integrate with the filefield_resource module - it's in elfinder/modules/elfinder_ffsel/elfinder_ffsel.module:
There on line 135 you find the same coding that caused the issue on the other sources.
Once I replaced
'wrapper' => $element['#id'] . '-ajax-wrapper',
with
'wrapper' => $element['upload_button']['#ajax']['wrapper'],
the preview loads again correctly.

Cheers

kenwest’s picture

The patch at #8 works for me. Cheers!

maxplus’s picture

Thanks a lot,

#8 saved my life!

Chris Burge’s picture

Status: Needs review » Reviewed & tested by the community
efruin’s picture

#8 worked for me.

d.sibaud’s picture

Patch #8 works fine

1mundus’s picture

#8 works.

Could this be committed? It's a pretty major flaw in the current release.

Chris Burge’s picture

Because the current recommend version of this module (7.x-1.9) is incompatible with Drupal 7.36+, I would think the committing of this issue would also force the release of 7.x-1.10 of FileField Sources.

Also, FileField Sources should add a core dependency to 7.x-1.10:

dependencies[] = system (>=7.36)

If a site is running Drupal 7.35 and updates to FileField Sources 7.x-1.10, then the uploads will break. This should be noted on the project page and in the release notes.

Chris Burge’s picture

Patch attached that 1) adds minimum Drupal core requirement and 2) notes requirement in README.

mgifford’s picture

Status: Reviewed & tested by the community » Needs review

Setting #24 as needs review. Hopefully it's just going back to rtbc.

Nothing wrong with what's in the README.txt & +dependencies[] = system (>=7.36) looks fine too.

joelhsmith’s picture

Patch #24 works perfectly. Thanks!

Rmeja’s picture

Patch #24 works fine

mgifford’s picture

@joelhsmith or @Rmeja can either of you mark it RTBC again? @Chris really shouldn't.

versantus.nik’s picture

Status: Needs review » Reviewed & tested by the community

I can also confirm that #24 works well.

bezu60’s picture

I am having similar issue. But not only is preview missing...it will not insert into Featured Image field. I can choose File Browser. I can Upload an image to the file browser. But if I try to "insert image" there is no preview and no image. If I save the page there is still no image.

Chris Burge’s picture

@bezu60, have you tried patching with #24? For others working this issue, take a look at #2510192: Unable to upload from file browser for featured image for more background on #30.

bezu60’s picture

I'm afraid I don't know how to apply a patch...hoping there will be an update before long :(

Chris Burge’s picture

To apply a patch, see https://www.drupal.org/patch/apply

In terms of a release, the latest recommended version of this module doesn't work with Drupal 7.36+, which includes a security release in 7.38. This should force another release of FileField Sources as soon as the patch is committed.

joelhsmith’s picture

@bezu60 If you don't know how to use Drush or Git you can still do it manually. Its pretty easy to do on a small patch like this. Follow these instructions. https://www.drupal.org/node/534548 I know you can do it :-)

bezu60’s picture

I can use the Upload option until they release the next update. I am really intimidated by the patch option.

bezu60’s picture

Also...still not sure my issue is the same issue. I don't just not get a preview...I can't insert an image from file browser at all.

bezu60’s picture

Used Patch manager module. Thank-you OS Training and everyone here! Patch #24 worked! I can now insert images from file browser again :)

Wow! Those of you who are comfortable with all of this can't imagine how great this feels :)

ron_s’s picture

Patch #24 does the job for me too. Thanks for the effort!

msamavi’s picture

Patch #24 worked for me too. Thanks!

profak’s picture

Patch #24 worked! Thanks!

Please, submit for next release!

fox mulder’s picture

Patch #24 solved the problem. Thanks!

DamienMcKenna’s picture

This should be added to the next release.

joelhsmith’s picture

Agreed this fix is definitely RBTC.

@quicksketch is truly a Drupal LEGEND. He is probably super busy with Drupal 8 stuff. I've reached out to him via Twitter to see if he can jump in and commit this patch. Its been a year and a half since the last commit to this module. Does anyone want to volunteer to help him as a maintainer?

profak’s picture

I can help maintain project as we (Acronis International) use this module on production heavily.

DamienMcKenna’s picture

@profak: You should open a new issue offering to co-maintain FFS, and contact Quicksketch via his contact page; see https://www.drupal.org/node/251466 for details on the d.o policy on this.

madelyncruz’s picture

Patch #24 works. Thank you. This must be committed though.

omarlopesino’s picture

The patch #24 worked for me too. Thanks!

Robert_W’s picture

Patch #24 worked for me too!

  • profak committed 60a1501 on 7.x-1.x
    Issue #2466247 by Chris Burge: Drupal core 7.36 broke Filefield Sources...
profak’s picture

Status: Reviewed & tested by the community » Fixed

Hello community!

Finally i got co-maintainer status. Thanks to @quicksketch!
Just pushed patch #24 to 7.x branch. Will review other issues and prepare next major release today.

joelhsmith’s picture

Congrats @Profak! Thank you so much!

quicksketch’s picture

+1 Thanks @profak!

profak’s picture

Status: Fixed » Closed (fixed)

In 7.x-1.10.

Sutry’s picture

#16

filefield_sources 7.x-1.10 doesn't fix problem with elFinder, but with your patch elFinder make preview correct (with filefield_sources 7.x-1.10 and previous).

A lot of thanks, hobbes_VT!

profak’s picture

@Sutry it's elFinder issue - not filefield_sources.
Please, re-read carefully @hobbes_VT's comment.