I have some weird behaviour in IE8 (with Flash) for the "Add files" button.

Setup:
drupal 7.15
filefield_sources 7.x-1.6
plupload 7.x-1.0

On a fresh install, I add an image field with the plupload filefield source widget. When I add a node (in Overlay), all works as expected. Clicking on the "Add files" button in the widget shows the file select dialog, where I can select multiple files.

The next time I see the widget and click the "Add files" button, the page jumps to the top, as if the javascript is not triggered any more (href="#"). I have the same behaviour when Overlay is not active.

Clearing the cache (even though caching is disabled) sets it back in the original state, that is that the button works, in the overlay, for the first time. Subsequent clicking results in said jumping to the top.

I have no idea what's going wrong here. I have not tested other version of IE9 (since it has to work with IE8 anyway), but it does work fine in Firefox & Chrome. I did try a couple of other jquery versions with jquery_update but to no avail.

Any ideas on what might be wrong here or where to start looking would be much appreciated.

Comments

sekhar33’s picture

Hi Ducktape, Im having the same issue, did you find the solution for this?

Thanks in Advance..!!

cakeandricemop’s picture

I experienced this issue as well. Spent a wee bit hours looking into it, best I came up with was a stackoverflow post about making the parent container display block. Not sure if this helps: http://stackoverflow.com/questions/8723491/flash-runtime-doesnt-work-in-...

Sc0tt’s picture

Had the same problem and updating to the latest Plupload 2 Beta dated Wed 28-11-2012 from the plupload website seemed to fix the problem.

cakeandricemop’s picture

I updated to the latest Plupload 2 Beta and now the "Add files" button does not work at all in IE 8 and 9. The old version worked the first time and then I would have to clear browser cache in order for it to work again. Now clicking the "Add files" button just jumps the page to the top.

Anonymous’s picture

I had to resort to force editors to use the flash fallback when using IE and removing references to the html4 runtime from both this module and the required plupload module since the configuration is being merged. All IE versions choked on the html4 runtime for one or another reason around here and despite the flash runtime having a higher priority ("html5,flash,html4"), sometimes html4 was still preferred over flash by the plugin. I'm not exactly sure, but I found multiple occurrences to the "runtimes" array in the Drupal JS object (the large chunk of serialized data in the header ;-) ). Not sure if that is duplication going on there or "working as designed".

The Beta of PLupload 2 didn't work at all here, I think it's not wise to go there yet anyways. But chances are very good that most of your IE users have flash installed, at least more likely than other browsers. The purists who will *never* install flash will not be using IE anyways already, and therefore will most certainly be fine with HTML5. :-)

tame4tex’s picture

@genox - are you able to provide more details on your solution. I removed the reference to "html4" in both filefield_sources_plupload.module and plupload.module and it didn't fix the issue.

I am experiencing this issue in IE9.

drupal 7.18
filefield_sources 7.x-1.7
plupload 7.x-1.1

All works ok first time uploading images. Then once they are uploaded, the "add files" link does nothing but take you to the top of the page.

Given that this issue affects basic functionality in IE9 I have changed its priority to major.

I am will to pay a developer to fix this issue (within reason). Any takers?

tame4tex’s picture

Priority: Normal » Major

sorry forgot to update Priority

Anonymous’s picture

@eelzee It seems to me that your issue is different from the one I had.

Try these things first:

- Clear Drupal cache (on "Performance" admin page)
- Clear browser cache
- Try again and ..
- .. use IE's developer tools and watch the script log section for any useful output while you are testing the module (press F12)

If you hover over the PLupload area with your mouse, a tool tip appears which holds the name of the currently used engine (html4, html5, flash, silverlight). Make sure that it uses the runtime you expect it to use.

ericc3’s picture

I'm also having trouble with this too on IE8 and lower when using the Flash runtime. This problem seems to happen very frequently, but there are some cases that I cannot reproduce where the "Add file" actually works.

I don't exactly have this same exact cause, but the end result is the same where clicking on the "Add files" link returns back to the top of the page from the a href=#. I'm currently using entityforms content where users can submit a form with the ability to upload files through the use of filefield sources / plupload widget.

Current setup:
drupal 7.16
filefield_sources 7.x-1.7
plupload 7.x-1.0
jquery update 7.x-2.3

IE9 works fine as well as FF and Chrome.

Anonymous’s picture

A bit OT but ... Did anyone come across a different and simpler approach to having multiple file uploads / batch uploads for filefields? I think part of the problem is the dependency on filefield_sources which itself changes a lot about the formfield forms and UI and the library module (plupload).

I wonder, is there a simple replacement for the default filefield form element without requiring 2-3 other modules? Just a simple HTML5 multifile upload element with flash fallback?

ericc3’s picture

I haven't tried other approaches as this seem like the best multiple upload tool available so far.

I think I have fixed my issue adding some js code to the plupload.js in this module. If anyone can give it a shot and let me know their results, I'd like to hear that!

I added this line of code below to the attach behavior function, as well as $(document).ready

  $(".filefield-source-plupload").click(function() { 
    var uploader = $('.plupload-element').pluploadQueue();
    uploader.refresh();
  });

in my plupload.js:

(function($) {

$(document).ready(function() {
  $(".filefield-source-plupload").click(function() { 
    var uploader = $('.plupload-element').pluploadQueue();
    uploader.refresh();
  });
});

Drupal.plupload = Drupal.plupload || {};

/**
 * Attaches the Plupload behavior to each FileField Sources Plupload form element.
 */
Drupal.behaviors.filefield_sources_plupload = {
  attach: function (context, settings) {
    $(".filefield-source-plupload").click(function() { 
      var uploader = $('.plupload-element').pluploadQueue();
      uploader.refresh();
    });
    $(".filefield-source-plupload .plupload-element", context).once('ffs-plupload-init', function () {

      // Merge the default settings and the element settings to get a full
      // settings object to pass to the Plupload library for this element.
      var id = $(this).attr('id');
      var defaultSettings = settings.plupload['_default'] ? settings.plupload['_default'] : {};
      var elementSettings = (id && settings.plupload[id]) ? settings.plupload[id] : {};
      var pluploadSettings = $.extend({}, defaultSettings, elementSettings);
tame4tex’s picture

I agree with ericc3, if you want the greatest browser compatibility than this is the best option. Multiupload Filefield Widget & Multiupload Imagefield Widget work well but are only HTML5 so no good for IE users for the time being.

Its the Flash runtime that I am having issue with.

Will do some debugging and report back.

hgneng’s picture

@ericc3
Thanks a lot!! You solution works for me. I spend more than one day to find this solution.

Here is some info that may helps debugging. There is a transparent flash layer above "add files" button at the first time. When we click "add files" link button, we actual click the flash. At the second time, it becomes a zero size div. So we click on the link button to "#". add border style to .flash will show the flash layer. I find this by forcing plupload to use flash version on Chrome. It's too hard to debug on IE...

Cameron

atlea’s picture

Status: Active » Fixed

This is now added to latest dev-release. Thanks! :)

Status: Fixed » Closed (fixed)

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

ali_b’s picture

In Opera: when clicking on the "Add files" link returns back to the top of the page from the a href=#.