GithubHelp home page GithubHelp logo

Comments (11)

ProgerXP avatar ProgerXP commented on June 10, 2024

I know about this and tries this but not all browsers support setting file's input value even to empty value. Notably Opera won't allow it.

Does it fix IE at least?

from filedrop.

rafaelmaiolla avatar rafaelmaiolla commented on June 10, 2024

The input.files property is read-only, but you can set the value for the input to be "".

I will change the code in my "fork", so you can see that I'm talking about.

from filedrop.

rafaelmaiolla avatar rafaelmaiolla commented on June 10, 2024

The change for that is the following:
rafaelmaiolla@7efc0fa

I don't know if that is the proper place to add this code, but this worked on Chrome and will probably work on IE.

from filedrop.

ProgerXP avatar ProgerXP commented on June 10, 2024

Like I've said it (still) doesn't work on IE but at least it works on Chrome and Firefox (tested). Implemented in 528f2ca. Thanks for another correction.

from filedrop.

rafaelmaiolla avatar rafaelmaiolla commented on June 10, 2024

You can make it work on IE too. But you need to remove the old input and add a new one in its place.
The following stackoverflow post explain how to do it using jQuery by cloning the old one, but you can do it on hand.
http://stackoverflow.com/questions/1043957/clearing-input-type-file-using-jquery/1043969#1043969

from filedrop.

ProgerXP avatar ProgerXP commented on June 10, 2024

I'm not sure it's a good idea to swap the input every time - it will lose all event bindings which might have been added outside of FIleDrop as well.

I will think about this though.

from filedrop.

rafaelmaiolla avatar rafaelmaiolla commented on June 10, 2024

I understand your concerns.

And I can implement the work-around for IE by myself...

If someone else need it, the code is the following (using jQuery - and of course this code is outside the library):

var $input = $(fileDrop.el).find(":file");
$input.replaceWith($input.clone());

fileDrop.opt.input = null;
fileDrop.hook(fileDrop.el);

from filedrop.

ProgerXP avatar ProgerXP commented on June 10, 2024

I will actually implement this in the next update with an option to disable input recreation (will be enabled by default). So stay tuned.

from filedrop.

rafaelmaiolla avatar rafaelmaiolla commented on June 10, 2024

Great!

from filedrop.

ProgerXP avatar ProgerXP commented on June 10, 2024

Implemented in 276e066. Turned out to be not so trivial (who would have guessed IE clones "by reference" and triggers submit once per every clone even after removing the old input?).

opt.recreateInput is true by default so your fix should be redundant now.

from filedrop.

rafaelmaiolla avatar rafaelmaiolla commented on June 10, 2024

thanks for that, I will download the newer version.

from filedrop.

Related Issues (20)

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.