Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#24 | filefield-sources-ajax-wrapper-2466247-24.patch | 3.81 KB | Chris Burge |
#8 | filefield-sources-ajax-wrapper-2466247-8.patch | 3 KB | David_Rothstein |
#2 | trim_file_element-id-2466247-3.patch | 1.45 KB | demandajmenso |
Comments
Comment #1
demandajmenso CreditAttribution: demandajmenso commentedThis is the core commit that breaks imce filefield source plugin
https://www.drupal.org/node/1734716
Comment #2
demandajmenso CreditAttribution: demandajmenso commentedHere is a patch.
Comment #3
demandajmenso CreditAttribution: demandajmenso commentedComment #4
David_Rothstein CreditAttribution: David_Rothstein commentedThis 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.
Comment #5
David_Rothstein CreditAttribution: David_Rothstein commentedAs 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.
Comment #6
David_Rothstein CreditAttribution: David_Rothstein commentedComment #7
David_Rothstein CreditAttribution: David_Rothstein commentedSimilar issue in another module.
Comment #8
David_Rothstein CreditAttribution: David_Rothstein commentedHere'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.
Comment #9
demandajmenso CreditAttribution: demandajmenso commentedNice.
Patch #8 offers a better all around solution.
Comment #10
Chris Burge CreditAttribution: Chris Burge commentedPatch #8 tests successfully for me.
Comment #11
vissutovega CreditAttribution: vissutovega commented@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
Comment #12
juanjo_vlc CreditAttribution: juanjo_vlc commentedThe patch at #8 worked for me.
Thanks @David_Rothstein
Comment #13
aitala CreditAttribution: aitala commentedPatch #8 worked for me...
Thanks!
Comment #14
partdigital CreditAttribution: partdigital commentedI can confirm that the patch in #8 worked for me.
Tested it on a stand-alone file upload field.
Comment #15
uno CreditAttribution: uno commented#8 solves preview problem for me.
TY
Comment #16
hobbes_VT CreditAttribution: hobbes_VT commentedHad 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
Comment #17
kenwest CreditAttribution: kenwest commentedThe patch at #8 works for me. Cheers!
Comment #18
maxplus CreditAttribution: maxplus commentedThanks a lot,
#8 saved my life!
Comment #19
Chris Burge CreditAttribution: Chris Burge commentedComment #20
efruin CreditAttribution: efruin commented#8 worked for me.
Comment #21
d.sibaud CreditAttribution: d.sibaud commentedPatch #8 works fine
Comment #22
1mundus CreditAttribution: 1mundus commented#8 works.
Could this be committed? It's a pretty major flaw in the current release.
Comment #23
Chris Burge CreditAttribution: Chris Burge commentedBecause 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:
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.
Comment #24
Chris Burge CreditAttribution: Chris Burge commentedPatch attached that 1) adds minimum Drupal core requirement and 2) notes requirement in README.
Comment #25
mgiffordSetting #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.Comment #26
joelhsmith CreditAttribution: joelhsmith as a volunteer commentedPatch #24 works perfectly. Thanks!
Comment #27
Rmeja CreditAttribution: Rmeja commentedPatch #24 works fine
Comment #28
mgifford@joelhsmith or @Rmeja can either of you mark it RTBC again? @Chris really shouldn't.
Comment #29
versantus.nik CreditAttribution: versantus.nik as a volunteer commentedI can also confirm that #24 works well.
Comment #30
bezu60 CreditAttribution: bezu60 commentedI 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.
Comment #31
Chris Burge CreditAttribution: Chris Burge commented@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.
Comment #32
bezu60 CreditAttribution: bezu60 commentedI'm afraid I don't know how to apply a patch...hoping there will be an update before long :(
Comment #33
Chris Burge CreditAttribution: Chris Burge commentedTo 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.
Comment #34
joelhsmith CreditAttribution: joelhsmith as a volunteer commented@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 :-)
Comment #35
bezu60 CreditAttribution: bezu60 commentedI can use the Upload option until they release the next update. I am really intimidated by the patch option.
Comment #36
bezu60 CreditAttribution: bezu60 commentedAlso...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.
Comment #37
bezu60 CreditAttribution: bezu60 commentedUsed 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 :)
Comment #38
ron_s CreditAttribution: ron_s commentedPatch #24 does the job for me too. Thanks for the effort!
Comment #39
msamavi CreditAttribution: msamavi commentedPatch #24 worked for me too. Thanks!
Comment #40
profak CreditAttribution: profak commentedPatch #24 worked! Thanks!
Please, submit for next release!
Comment #41
fox mulder CreditAttribution: fox mulder commentedPatch #24 solved the problem. Thanks!
Comment #42
DamienMcKennaThis should be added to the next release.
Comment #43
joelhsmith CreditAttribution: joelhsmith as a volunteer commentedAgreed 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?
Comment #44
profak CreditAttribution: profak commentedI can help maintain project as we (Acronis International) use this module on production heavily.
Comment #45
DamienMcKenna@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.
Comment #46
madelyncruz CreditAttribution: madelyncruz commentedPatch #24 works. Thank you. This must be committed though.
Comment #47
omarlopesinoThe patch #24 worked for me too. Thanks!
Comment #48
Robert_W CreditAttribution: Robert_W commentedPatch #24 worked for me too!
Comment #50
profak CreditAttribution: profak as a volunteer commentedHello 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.
Comment #51
joelhsmith CreditAttribution: joelhsmith as a volunteer commentedCongrats @Profak! Thank you so much!
Comment #52
quicksketch+1 Thanks @profak!
Comment #53
profak CreditAttribution: profak as a volunteer commentedIn 7.x-1.10.
Comment #54
Sutry CreditAttribution: Sutry commented#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!
Comment #55
profak CreditAttribution: profak as a volunteer commented@Sutry it's elFinder issue - not filefield_sources.
Please, re-read carefully @hobbes_VT's comment.