Giter Site home page Giter Site logo

moxie's People

Contributors

afraithe avatar apaleslimghost avatar aramalipoor avatar danii-nebot avatar defrex avatar eegee avatar eric1234 avatar euskadi31 avatar jayarjo avatar karlqumu avatar linaspasv avatar lqpppp avatar martinbooth avatar mkorzilov avatar mmodzelewski avatar mqko avatar nazar-pc avatar skalooza avatar spocke avatar tiff avatar vakata avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moxie's Issues

Zip file has incorrect MIME type

mOxie translates the .zip extension to a MIME type of application/zip, but Chrome internally maps to application/octet-stream and Firefox/IE map to application/x-zip-compressed.

Tested on Chrome 32, Firefox 26 and IE11.

shimContainer is not removed when the uploader is destroyed

I'm not sure but after debbuging I think the problem is:

The dom element is removed with

shimContainer.parentNode.removeChild(shimContainer);

but after it, you call to

obj.instance.destroy.call(obj.context);

which calls to "getShimContainer" and it recreates the shim container.

CallFunction is undefined on ie8 or ie9

function __flash__addCallback(instance, name) {
instance[name] = function () {
return eval(instance.CallFunction("<invoke name=""+name+"" returntype="javascript">" + __flash__argumentsToXML(arguments,0) + ""));
}
}

Add readAsArrayBuffer and drop support for readAsBinaryString

It appears that readAsBinaryString is no longer supported by the HTML5 spec. Although implemented in some browsers (Chrome, Firefox) it will likely be removed in future releases. In addition IE10 was released late enough that they never needed to support it (but they do support readAsArrayBuffer and readAsText and readAsDataURL).

The end result of the current situation is that:

  • If I use readAsBinaryString it seems to work most places. But I get an error in IE10 (complaining about the method not existing). I imagine future version of Firefox and Webkit will behave the same.
  • If I use readAsArrayBuffer it will work on all modern browsers (including IE10) but it will not work on browsers using the flash fallback since the flash fallback doesn't provide support for readAsArrayBuffer.
  • readAsText should work everywhere. But if you plan to use interact with the data you might get issues since it will apply character encoding mojo. I don't need to interact with the data in a meaningful way (just doing a hash of some of the data) so I will probably try this one.
  • readAsDataURL also should work everywhere. But since it is base64 encoded I think it will increase the file size by 37% which could affect performance.

Detaching FileInput's <object> from the DOM breaks the uploaded file instance

Context:

I have a mOxie.FileInput() that adds an <object> to the DOM over the "input" element. The user uploads a file that I yield via fileInput.onchange. Browser is IE9.

When I remove the <object> from the DOM the file instance cannot be uploaded anymore via the XHR2 shim. Even when detaching the node and re-adding in the same place the file instance seems broken.

Minimal example (adapted from #28):

<!DOCTYPE HTML>
<html>
<head>
    <meta charset='utf-8'/>
    <script type="text/javascript" src="lib/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="lib/moxie.js"></script>
    <script>
    $(function () {
        var ajax = function (method, url, data, successCallback, errorCallback) {
            var ajaxRequest = new mOxie.XMLHttpRequest();
            ajaxRequest.onload = function () {
                if (ajaxRequest.status === 200 || ajaxRequest.status === 0) {
                    successCallback(ajaxRequest.response);
                } else {
                    errorCallback(ajaxRequest.status);
                }
            };

            ajaxRequest.onerror = function (e) {
                errorCallback(e);
            };

            ajaxRequest.open(method, url, true);
            ajaxRequest.setRequestHeader('Content-Type', 'application/octet-stream');
            ajaxRequest.send(data, {
                swf_url: "lib/Moxie.min.swf"
            });
        };

        fileInput = new mOxie.FileInput({
            browse_button: "button",
            swf_url: "lib/Moxie.min.swf"
        });
        fileInput.onchange = function (e) {
            console.log("change", e.target.files[0]);

            // Here we de- and re-attach the flash node
            $("object").detach().appendTo(".moxie-shim");

            ajax("post", "/something", e.target.files[0], function () {
                console.log("success");
            }, function (e) {
                console.log("error", JSON.stringify(e));
            });
        };
        fileInput.init();
    });
    </script>
</head>
<body>
    <div id="button">The button</div>
</body>
</html>

In this example no error message is shown, but no POST is triggered. In a different, bigger example, I yield a message

TypeError: Unable to get value of the property 'exec': object is null or undefinedundefined

The behaviour described here can be seen in dynamic applications, where in one view the file is uploaded and in another one is stored to the server. For us this bug breaks the ability to use moxie as a HTML5 File polyfill.

Trigger onchange on original element

In case the mOxie.FileInput is used as a polyfill on top of a classical <input type=file> it would make sense to trigger the onchange event on that element. In this case mOxie could be used as a transparent polyfill without the need for a change within the native HTML5 implementation.

Right now what you possibly need to do is

    fileInput.onchange = function (e) {
        originalElem.onchange(e);
    };

Resizing Images

Hello,
we use plupload in our Company as the essential tool for Upload Images (OEM License).
We habe the following Problem:

We want to resize images with the following Values(1024 x 2045, quality 90), if i have an Image with the following format (2688 x 1520) then the resized Image has not enough Quality to print in 20x30cm Photocard.

I found a solution which i want to add in the plupload javascript and Flash code.

My Question :
How can i get the plupload JS and Actionscript Code to add my changes into?

thanks

Samer

IE9 - Image onload doesn't seem to ever be called (flash)

I expect I'm doing something wrong, but onload is never called for an image in IE9 using the flash shim.
For example none of the following seem to work as expected, it just silently fails:

var _i=document.createElement('img');
// initialise _i
var img=new mOxie.Image();
img.onload=function(e){console.log('worked');};
img.load(_i);

var _c=document.createElement('canvas');
var img=new mOxie.Image();
img.onload=function(e){console.log('worked');};
img.load(_c.getDataURL('image/jpeg', 0.9); // using png, etc doesn't work either

var _f=file; // from fileinput for example
var img=new mOxie.Image();
img.onload=function(e){console.log('worked');};
img.load(_f);

Any suggestions?

Thanks

Uploading a file via Silverlight runtime builds an incomplete multipart

When uploading a file object via o.XMLHttpRequest using the Silverlight runtime under IE9 sends an incomplete multipart to the server missing the file's body. The file is yielded from a mOxie.FileInput.

ajaxRequest.open("post", url, true);
ajaxRequest.setRequestHeader('Content-Type', 'application/octet-stream');
ajaxRequest.send(file.getSource(), {
    swf_url: "lib/Moxie.xap"
});

Yielded request body (copied from the IE9 output):


--------------------------7dd39c331012c--

Multipart seems to be the way the Silverlight runtime sends it's content, I'd gladly take anything that works.

See #28 for a complete example using the Flash runtime instead.

Flash FileReader performance

The FileReader Flash polyfill seems to read the entire file even if I just request a slice. One it is done reading the entire file it does correctly return just the slice I asked for. But this means if I ask for a small slice (1K) of a large file (1.8 GB) I am stuck waiting for a while. Also since it seems to read the entire thing into memory that would seem like a pretty heavy load on the client.

I took a look at the FileReference API provided by flash (which Moxie seems to be using to read the file) and it doesn't seem to provide a way to read just a part of the file. So this may just be a fundamental limitation of the flash fallback. But I thought I would open a ticket to verify this limitation before giving up.

Is my understanding correct? If I ask for just a small bit of a file it will read the entire thing into memory when using the flash fallback?

IE 11 browser detenction variables doesn´t set correctly

In IE 11 the object property Env.browser, it doesn´t set correctly; it set to Mozilla.

To solve the issue I change the file src/javascript/core/utils/Env.js; and add the following object to the variable browser
{
s1: navigator.userAgent,
s2: "Trident",
id: "IE",
sv: "rv"
}

Silverlight fixes

I got the latest moxie and plupload code today as I plan to use the HTML5 and Silverlight runtimes for very large (>4gb) file uploads. HTML5 worked, but I had some errors with Silverlight, so I debugged them and this is what I had to do to get it to work for me.

First, when the Blob destroy method is getting called it is getting passed an argument. The current Blob.cs code destroy method does not have any arguments so reflection was unable to locate the method and throwing and error. To fix, all I had to do was change the method to include an argument like public void destroy(object obj=null) and that allowed me to start uploading.

Next, I noticed that while it was uploading silverlight was throwing an NotImplementedException for every Blob that was uploaded. I tracked this down to the XMLHttpRequest _responseCallback method. The line if (response.Headers is WebHeaderCollection) can be changed to if (response.SupportsHeaders && response.Headers is WebHeaderCollection) to prevent these exceptions from being thrown. The exception is thrown as soon as the response.Headers property is accessed when using the BrowserHttp client.

The last issue I found was an integer / long issue that causes an error to occur when silverlight tries to slice a file beyond the int32 limit. This was fixed easily by changing the private Blob _slice(int start, int end, string type) method to private Blob _slice(long start, long end, string type) and this line Blob blob = _slice(Convert.ToInt32(start), Convert.ToInt32(end), (string)type); to Blob blob = _slice(Convert.ToInt64(start), Convert.ToInt64(end), (string)type); in the slice method

Hope this was helpful.

Cross-Domain GET Request via Flash Runtime

I'm trying to do a cross-domain GET request via the flash runtime. It makes the request fine and I can see the correct data in my response. The mime type is text/plain. But responseText is blank and responseType is blank. I'll probably dig into this this afternoon but figured I would post a question to see if this is just a limitation on the Flash component or if I should be able to get cross-domain content.

PNG got _purge() twice and lead to undefined the secontime

I just compiled 607acd9 and tested it with a PNG image.
I got Uncaught TypeError: Cannot call method 'init' of null
I set breakpoint at .init and I can see that it goes into that line twice. Is this a normal behavior? Should _br be wrapped with a null checker?

function _purge() {
            _br.init(null);
            _binstr = _info = _hm = _ep = _br = null;
        }

A simple if (_br) would be suffice to fix this for me.

Flash runtime does not write an extra CR/LF to end of the multipart request

I'm attempting to use plupload 2.0 to upload files to a .NET WebAPI server and there is an issue with the Flash runtime not writing an extra CR/LF to end the multipart request. Technically, it's not required, but the .NET WebAPI runtime breaks if the request does not end with a CR/LF (see this issue and this discussion on CodePlex). It doesn't look like they are not going to fix the problem on their end either. 👎

The following is an example request sent from the Flash runtime:

POST http://localhost:38893/api/upload HTTP/1.1
Host: localhost:38893
Connection: keep-alive
Content-Length: 634
Origin: http://localhost:38893
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
Content-Type: multipart/form-data; boundary=----------gL6cH2GI3GI3Ef1Ij5Ij5cH2gL6KM7
Accept: */*
Referer: http://localhost:38893/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

------------gL6cH2GI3GI3Ef1Ij5Ij5cH2gL6KM7
Content-Disposition: form-data; name="Filename"

cldbuild02.rdp
------------gL6cH2GI3GI3Ef1Ij5Ij5cH2gL6KM7
Content-Disposition: form-data; name="name"

cldbuild02.rdp
------------gL6cH2GI3GI3Ef1Ij5Ij5cH2gL6KM7
Content-Disposition: form-data; name="file"; filename="cldbuild02.rdp"
Content-Type: application/octet-stream

full address:s:cldbuild02:3389
username:s:Administrator
prompt for credentials:i:1


------------gL6cH2GI3GI3Ef1Ij5Ij5cH2gL6KM7
Content-Disposition: form-data; name="Upload"

Submit Query
------------gL6cH2GI3GI3Ef1Ij5Ij5cH2gL6KM7--

And here is the request using the HTML5 runtime:

POST http://localhost:38893/api/upload HTTP/1.1
Host: localhost:38893
Connection: keep-alive
Content-Length: 412
Origin: http://localhost:38893
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryqrB60GCabhnOAE2F
Accept: */*
Referer: http://localhost:38893/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

------WebKitFormBoundaryqrB60GCabhnOAE2F
Content-Disposition: form-data; name="name"

cldbuild02.rdp
------WebKitFormBoundaryqrB60GCabhnOAE2F
Content-Disposition: form-data; name="file"; filename="cldbuild02.rdp"
Content-Type: application/octet-stream

full address:s:cldbuild02:3389
username:s:Administrator
prompt for credentials:i:1


------WebKitFormBoundaryqrB60GCabhnOAE2F--

Both the HTML5 and Silverlight runtimes give that extra CR/LF at the end of the request. Can the Flash runtime be changed to output it as well?

Thanks!

Slower performance generating embedded thumbs.

From the changes made in commit cfc8f24 (Image, HTML5: Remove getAsImage), the generation of embedded thumbs seems to be almost twice as slow as before. E.g. when selecting 10 jpg files of about 5 MB, before the change, it took about 7 seconds to generate 80x60 pixel thumbs. After the change, it takes 12 seconds.

Seems to be caused especially by the change in line 84/85 of src/javascript/runtime/html5/image/Image.js

_loadFromDataUrl.call(this, img.getAsDataURL());

to

_img = img.getAsImage();
this.trigger('load', me.getInfo.call(this));

Wrong zIndex on browseButton

The zIndex is retrieved from the configured browseButton, but if it's inside a container (div) with a zIndex then it will not be calculated correctly.

Maybe you should check the zIndex of all parent nodes.

Adding Cross-Domain Request Capability

I am making cross domain requests. Most runtimes support this:

  • xhr2 via CORS
  • flash via crossdomain.xml
  • html4 since it uses iframe which can be cross-domain
  • I am unsure about Silverlight.

Legacy XHR (i.e. "native" XHR in moxie terms) does not. I'm looking for the quickest way to move forward which seems to be just modifying _canUseNativeXHR to check _same_origin_flag. If not the same origin then we pass off to the non-"native" runtimes.

But I was wondering if I am simplifying it too much. Should each runtime have a "cross-domain" capability flag? This would be true on Flash (we assume they have setup the crossdomain.xml file). This would also be true for html4. I am unsure if it is always true for html5. Obviously we assume they setup CORS on the webserver. But do browsers exist that support XHR2 but not CORS? I found some tests we could use if that is the case.

Only html4 runtime in old-IE

I tested moxie in a local IIS site and everything worked great in all browsers. Meaning, flash was working in oldIE. Once I put the files into the clients site oldIE does not use the flash runtime, it uses the html4 runtime, which isn't working. It is an asp.net web-forms site which has a form element around the whole page.
[body][form id='aspnetForm'] ...(everything)... [/form][/body]
Rather then troubleshoot that I am trying everything to get the flash or silverlight runtimes going. I verified the .swf and .xap files are there and getting served up. I tried "multiple: true" because I read that disabled the html4 runtime.
BTW, the error I get in IE9 during html4 runtime is:
Message: INVALID_STATE_ERR: INVALID_STATE_ERR: DOMException 11
Line: 3320
URI: moxie.js

thumbnails not showing up in ie6,7,8

Hi, I am running Plupload2 Beta, jquery ui widget using the Flash runtime on ie7 and ie8.
When I try to upload images in the 300-500kb range I just get the loading icon (even when uploading just 1 image). The thumb does appear on a small file (28kb), however, and it also works fine in ie9 for the larger flles.
I found a site that has a sample of showing thumbs in the flash runtime that does not have this issue but I am unsure how to integrate: http://kasparsj.wordpress.com/2011/04/18/show-image-thumbnails-in-plupload-queue-widget/
Thanks for a great product, it really is amazing

http://www.plupload.com/punbb/viewtopic.php?id=2625

HTML5 + Flash Precompiled

The pre-built binaries support all runtimes. But I (and I imagine many others) just want HTML5 (for the latest browsers) and Flash (for the older browser). The other runtimes are unlikely to be used. They seem mostly defunkt:

  • Rumors have it that Silverlight will not have a version 6 and version 5 has an end-of-life of 2021.
  • Development on Gears has ceased
  • BrowserPlus has had no activity for about 2 years (although I can't find any official statement to indicate it is discontinued).

I understand some may have use for the other runtimes so I don't think we need to get rid of them. But I don't think their use is the common case. So I wanted to suggest we also have pre-built binaries for just HTML5 and Flash.

Obviously I can build this myself (and likely will if I don't get any response on this thread). But figured others might hit this same issue and we can save everybody time by not requiring them to compile themselves.

Thumbs not rendering in IE10

From commit 6887860 (March 8) on, preview thumbs are not rendering anymore in IE10.
Tried with IE 10.0.9200.16540 (lastest as of now) on 64 bit Windows 7

I made a test case where you could see behaviour in different versions of Moxie:
http://printsjelle.pixxer.nl/nictest/
In version 25c284b of March 7, thumbs are still showing if you add jpeg-files. From version 6887860 on, they don't display anymore.

Unable to build javascript

When I try to use jake mkjs, I get the following error.

$ node_modules/.bin/jake mkjs --trace
jake aborted.
Error: Cannot find module './utils'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/defrex/code/moxie/node_modules/amdlc/lib/AmdCompiler.js:6:13)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Taking a quick look, I can see that most of the files in the build directory require ./utils, and there is no build/utils directory.

Support Selenium

A feature request. Hope this makes sense.

We use moxie as fallback under IE8/9. Because of the nature of the fallback, we feel we cannot adequately support the implementation with unit tests and would like to run our Selenium-Suite against an instance of IE9 too.

It now seems that uploading a file through the Flash overlay is not easily doable. Would it be possible to provide a simple entry point into the Flash runtime to fake a file upload?

What I'd envision is

fileInput.fakeUpload("fileName", "data:image/png;base64,theFilesContentAsBase64");

I'd look into this myself, but due to the needed bridge into Flash have to pass.

Flash's Image.getAsDataURL taking 9.5 seconds and returning null for 2448 × 3264 jpeg image

Is there any known issues with larger files (my specific image example is a photo from a iphone 4 camera) and the Flash Image APIs? getAsDataURL is returning null and taking 9.5 seconds to do so. Is getAsDataURL() async and there's some event I should bind a callback for?:

#2448 × 3264 jpeg with EXIF orientation 6
reader started
reader finished loading 0.43199992179870605 seconds
image finished loading 0.8690001964569092 seconds
image finished resizing 0.4009997844696045 seconds
finished img.getAsDataURL 9.52400016784668 seconds

Compared to the speedy HTML5 runtime:

# Same 2448 × 3264 jpeg with EXIF orientation 6
reader started
reader finished loading 0.12800002098083496 seconds
image finished loading 0.2999999523162842 seconds
image finished resizing 0.16100001335144043 seconds
finished img.getAsDataURL 1.309999942779541 seconds

The Flash Image's getAsDataURL does work fine for me with smaller image and returns a real dataURL.

My code is doing the following:

  1. using mOxie FileInput
  2. using mOxie FileReader to read file as dataURL.
  3. creating a mOxie Image and loading it with that read dataURL.
  4. calling downsize on the mOxie Image instance with false argument for preserve headers.
  5. calling getAsDataURL('image/jpeg', 100) on mOxie Image instance after 'Resize' event

Here's a snippet of my code:

      Controller.prototype.show = function(file, callback) {
        var _this = this;
        this.callback = callback;
        this.reader.onload = function(event) {
          var img, newTime, time, view;
          newTime = new Date().getTime() / 1000;
          console.log("reader finished loading", newTime - _this.time + " seconds");
          time = newTime;
          _this.dataURL = event.target.result;
          if (_this._browserAutoOrientsImages()) {
            view = _this._getView({
              model: new App.Entities.Model({
                cropImageSrcData: _this.dataURL
              })
            });
            return _this.region.show(view);
          } else {
            img = new mOxie.Image();
            img.bind("Load", function() {
              var orientation;
              newTime = new Date().getTime() / 1000;
              console.log("image finished loading", newTime - time + " seconds");
              time = newTime;
              orientation = (img.meta && img.meta.tiff && img.meta.tiff.Orientation) || 1;
              if (_.indexOf([5, 6, 7, 8], orientation) !== -1) {
                img.bind("Resize", function() {
                  newTime = new Date().getTime() / 1000;
                  console.log("image finished resizing", newTime - time + " seconds");
                  time = newTime;
                  _this.dataURL = img.getAsDataURL('image/jpeg', 100);
                  newTime = new Date().getTime() / 1000;
                  console.log("finished img.getAsDataURL", newTime - time + " seconds");
                  time = newTime;
                  view = _this._getView({
                    model: new App.Entities.Model({
                      cropImageSrcData: _this.dataURL
                    })
                  });
                  return _this.region.show(view);
                });
                return img.downsize(img.height, img.width, false, false);
              } else {
                view = _this._getView({
                  model: new App.Entities.Model({
                    cropImageSrcData: _this.dataURL
                  })
                });
                return _this.region.show(view);
              }
            });
            return img.load(_this.dataURL);
          }
        };
        this.time = new Date().getTime() / 1000;
        console.log("reader started");
        return this.reader.readAsDataURL(file);
      };

Android - object #FileReader has no method addEventListener

While running Moxie under android (4.0.3) I get the above error when doing this for example:

var fi=new mOxie.FileInput({
browse_button: 'mybutton',
accept:'image.*'
});
fi.addEventListener('change', function(e){
var fr=new mOxie.FileReader();
fr.onload=function(e){console.log('loaded');};
fr.readAsDataURL(this.files[0]);
});

I replaced the event setup code in FileReader.read with this:

function removeEventListeners() {
Basic.each(events, function(name) {
if (fr.removeEventListener)
fr.removeEventListener(name, reDispatch);
else
fr['on'+name]=null;
});
if (fr.removeEventListener)
fr.removeEventListener('loadend', removeEventListeners);
else
fr.onloadend=null;
}

Basic.each(events, function(name) {
if (fr.addEventListener)
fr.addEventListener(name, reDispatch);
else
fr['on'+name]=reDispatch;
});
if (fr.addEventListener)
fr.addEventListener('loadend', removeEventListeners);
else
fr['onloadend']=removeEventListeners;

Silverlight runtime doesn't set proper Content-Type inside multipart for unknown file type

I'm attempting to use plupload 2.0 to upload files to a .NET WebAPI server and there is an issue with the Silverlight runtime not setting the proper Content-Type for an unknown file type (in this case, an .rdp file). Using Fiddler, the request sent by the Silverlight runtime is below:

POST http://localhost:38893/api/upload HTTP/1.1
Host: localhost:38893
Connection: keep-alive
Content-Length: 334
Origin: http://localhost:38893
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
content-type: multipart/form-data; boundary=----moxieboundary816
Accept: */*
Referer: http://localhost:38893/Scripts/Moxie.xap
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

------moxieboundary816
Content-Disposition: form-data; name="name"

cldbuild02.rdp
------moxieboundary816
Content-Disposition: form-data; name="file"; filename="cldbuild02.rdp"
Content-Type: 

full address:s:cldbuild02:3389
username:s:Administrator
prompt for credentials:i:1


------moxieboundary816--

You'll notice that in the second part the Content-Type is blank. If I use the HTML5 runtime I get the following request:

POST http://localhost:38893/api/upload HTTP/1.1
Host: localhost:38893
Connection: keep-alive
Content-Length: 412
Origin: http://localhost:38893
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryqrB60GCabhnOAE2F
Accept: */*
Referer: http://localhost:38893/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

------WebKitFormBoundaryqrB60GCabhnOAE2F
Content-Disposition: form-data; name="name"

cldbuild02.rdp
------WebKitFormBoundaryqrB60GCabhnOAE2F
Content-Disposition: form-data; name="file"; filename="cldbuild02.rdp"
Content-Type: application/octet-stream

full address:s:cldbuild02:3389
username:s:Administrator
prompt for credentials:i:1


------WebKitFormBoundaryqrB60GCabhnOAE2F--

As you can see, the Content-Type defaults to application/octet-stream. The Flash runtime also defaults to application/octet-stream. Can the Silverlight runtime also default to this value? Unfortunately the .NET WebAPI throws an error if the Content-Type is blank.

Thanks!

Uploading a o.File through o.XMLHttpRequest does not work in IE9

While the following example works well in Chrome, an unspecified error event is returned in IE9.

How to reproduce:
Open the page in the browser and click on "The button" and select a file. Output is logged to the console.

<!DOCTYPE HTML>
<html>
<head>
    <meta charset='utf-8'/>
    <script type="text/javascript" src="lib/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="lib/moxie.js"></script>
    <script>
    $(function () {
        var ajax = function (method, url, data, successCallback, errorCallback) {
            var ajaxRequest = new mOxie.XMLHttpRequest();
            ajaxRequest.onload = function () {
                if (ajaxRequest.status === 200 || ajaxRequest.status === 0) {
                    successCallback(ajaxRequest.response);
                } else {
                    errorCallback(ajaxRequest.status);
                }
            };

            ajaxRequest.onerror = function (e) {
                errorCallback(e);
            };

            ajaxRequest.open(method, url, true);
            ajaxRequest.setRequestHeader('Content-Type', 'application/octet-stream');
            ajaxRequest.send(data, {
                swf_url: "lib/Moxie.min.swf"
            });
        };

        fileInput = new mOxie.FileInput({
            browse_button: "button",
            swf_url: "lib/Moxie.min.swf"
        });
        fileInput.onchange = function (e) {
            console.log("change", e.target.files[0]);

            ajax("put", "/something", e.target.files[0].getSource(), function () {
                console.log("success");
            }, function (e) {
                console.log("error", JSON.stringify(e));
            });
        };
        fileInput.init();
    });
    </script>
</head>
<body>
    <div id="button">The button</div>
</body>
</html>

Upload URL misparsed by parseUrl regex

src/javascript/core/utils/Url.js

Consider the invalid data structure created from a URL of the form...

https://host.domain.tld/[email protected]/folder

{
"path": "/folder",
"host": "b.c",
"user": "host.domain.tld/a",
"scheme": "https",
"source": "https://host.domain.tld/[email protected]/folder"
}

contrast that with a working one created from the URL...

https://host.domain.tld/name/folder

{
"path": "/name/folder",
"host": "host.domain.tld",
"scheme": "https",
"source": "https://host.domain.tld/name/folder"
}

Wrong scope of "self" variable

When the runtime is destroyed, I think it's using "self" variable from "window" scope.
I'm using ExtJS 3.4 which uses "self" as "window.self", and after destroy the uploader some code fails because "window.self" is null.

Maybe, some "var self" is missing.

_uid = self = _shim = shimContainer = null;

Starting upload in plupload2

Hi,

I have a question regarding the new plupload-API.
I do not see a way, to send the uploaded Files.

I used this to successfully instantiate the uploading mechanism:

    uploader = new o.FileInput({
        browse_button: 'pickfiles',
        container: 'container',
        accept: [
            {title: "Image files", extensions: "jpg,gif,png"} // accept only images
        ],
        multiple: true
    }); 

I tried something similar as this:

$('#uploadfiles').click(function() {
    var request = new o.XMLHttpRequest();
    request.open('POST', '/bilder/inline/plupload');
    request.send();
    return false; 
}); 

But nothing happens.

Any suggestions, as how to accomplish a separate fileupload as in the previous plupload version?

Thank you in advance
Markus

Safari 5 - window.FileReader is undefined

When using safari 5, window.FileReader is not defined, therefore if you try to read a moxie file or blob using a filereader it fails as it falls back to html5 because the file objects were created that way. Shouldn't it detect if filereader is available and use a shim if not?

Safari & Html5

Hi,
I had an issue with safari 5.1.7(7534.57.2). The library work like there is support for html5 FileReader, but safari fails to provide one(I think the library should fallback to flash, but it doesn't). I couldn't spend more time to find proper fix for my problem, so I made dirty fix by changing the order of the Runtimes.

Runtime.order = 'flash,html5,silverlight,html4';

Still I am not sure if this is an actual issue or I made some mistake. I admire you for the effort and the great design. If there is something I can help with please contact me.

license related question

i always get confused if license is not MIT or BSD, so my question:
if this project is bundled in python/ruby package for easier integration w/ rails/django/others can it be used in commercial projects?

Flash FileInput + Twitter Bootstrap Button Dropdown component not able to get selected file more than once

Hi jayarjo,

I have a fiddle here that attempts to use a mOxie FileInput with its container as a dropdown menu item in a 2.3.2 Twitter Bootstrap Button Dropdown component. The fiddle has steps to reproduce, expected, and actual observations. http://jsfiddle.net/aqxDd/5/

The FileInput in unable to register that it has a file on the second file selection attempt. Given the implementation of the Button Dropdown, the FileInput's container element's parent (ul class="dropdown-menu") will have a display:none style when closed and display:block when open.

I believe the toggling of display:none/display:block may be a clue into the reason the FileInput can't get a file the second time, but I'm unfamiliar with swf objects and how they behave when their display is toggled. I can assure that the swf object is displayed at the time when it is used, but when inactive it is not displayed.

Do you think it's possible to get this type of file selection experience to work with moxie?

event.target.result is undefined in onload handler for o.FileReader

uploader.bind('FilesAdded', function(up, files){handleImage(files);});

function handleImage(files){

    mOxie.each(files, function(file) { // o is global alias for mOxie
        var reader = new mOxie.FileReader();
        reader.onload = function(event){
            var img = new Image();
            img.onload = function() {
                fabric.Image.fromURL(img.src, function(imag){
                    fBookUserImgLoaded = true;
                    
                    fBookUserImgOrg = imag;
                   
                    imag = img = null;
                    prepImg();
                });
            
            };
            img.src = event.target.result;
        };
        // passing bare file object here, although not always equal to native one used by browser
        reader.readAsDataURL(file.getSource()); 
    });
}

"this way it works with html5 runtime but when i change the runtime to flash or silverlight:
"event.target.result" returns undefined
when i debug the code i see that dataurl is retuned from flash or silverlight with no problem but I couldn't find where exactly event.target.result filled."

Original topic: http://www.plupload.com/punbb/viewtopic.php?pid=9420#p9420

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.