Bucket
Bucket

Reputation: 7521

Multi-file Flash Uploader

I am using Dojo 1.8. I have defined an Uploader that supports multiple attachments in Firefox, Chrome, and Safari, but when I submit the form in IE9, multiple POST requests are made instead of just one.

Below is a rough synopsis of my code. I load the Flash plugin so the Uploader will run in IE (the IFrame and HTML5 plugins do not work). Any reason as to why this behaves so much differently from the other browsers besides IE simply being itself?

define([
    'dojox/form/Uploader',
    'dojox/form/uploader/FileList',
    'dojox/form/uploader/plugins/Flash'
], function(Uploader, FileList) {

...

    this.u = new dojox.form.Uploader({
        label: "Browse...",
        multiple: true,
        uploadOnSelect: false,
        url: 'uploadServlet'
    });

    this.list = new FileList({
        uploader: u
    });

...

    this.u.startup();
    this.list.startup();

});

Upvotes: 0

Views: 478

Answers (3)

Bucket
Bucket

Reputation: 7521

After wrestling with the Flash plugin for the Uploader, I have come to the following (disappointing) results:

  • IE doesn't play nicely with multiple attachments. I sniffed the user agent with has("ie"), and handled IE's attachment uploading differently from other browsers. Following this, I shook my fist angrily at IE and cursed its family.
  • Unless I set force="flash" on the Uploader, all other browsers will use the HTML5 plugin, which works great.
  • The IFrame plugin is a no-go for IE. More cursing and angry fist-shaking.

This is overall a little bit of a letdown, since Dojo was supposed to enable cross-platform support for all of the major browsers (in which IE is still included, unfortunately), but the dojox bundles are still a bit buggy. Hopefully this functionality will improve in 2.0.

Upvotes: 0

Ivo Silva
Ivo Silva

Reputation: 350

On dojo 1.9.1, the Flash plugin displays the following warning message:

dojox.form.uploader.plugins.Flash has been removed. You can use Uploader directly and it will contain all necessary functionality.

So, I guess you don't need to load any plugin, the Uploader will do that for you.

Upvotes: 1

Philippe
Philippe

Reputation: 6828

That's the default behavior of the Flash plugin. All other browsers that support HTML5 file inputs with multiple="true" use the HTML5 plugin unless you force flash.

Upvotes: 0

Related Questions