Comments (4)
The plugin is just to customize the input file, it will not upload a plugin. You are the one to apply the extra functionality.
from bootstrap-filestyle.
It's not about upload. It's about selecting the file. For example, native HTML input type="file" supports Drag-n-Drop in Firefox (maybe in other browsers too), but bootstrap-filestyle doesn't support it
from bootstrap-filestyle.
Any news on this one? It will be really useful to have drag & drop available for all browsers
from bootstrap-filestyle.
Hi.
I manage to get this beahviour working (native selection with drag & drop in browsers, without ajax or async uploads) with some minor tweaks to the js, following this idea http://www.quirksmode.org/dom/inputfile.html.
I'm not very good with git so I will paste the changes here. They are only minor style changes for the bootstrap-filestyle.js version 1.2.1. For simplicity replace lines 243 to 255 with these
_self.$elementFilestyle = $('<div class="bootstrap-filestyle input-group" style="position: absolute; top: 0px; left: 0px; z-index: 1;">' + html + '</div>');
_self.$elementFilestyle.find('.group-span-filestyle').attr('tabindex', "0").keypress(function(e) {
if (e.keyCode === 13 || e.charCode === 32) {
_self.$elementFilestyle.find('label').click();
return false;
}
});
// hidding input file and add filestyle
_self.$element.css({
'-moz-opacity': 1,
'filter': 'alpha(opacity: 1)',
'opacity': 0,
'position': 'relative',
'text-align': 'right',
'z-index': 2
}).attr('tabindex', "-1").addClass('form-control').wrap('<div style="position: relative;"></div>').after(_self.$elementFilestyle);
This works for me in IE 11, Chrome, Firefox and Safari for Windows (I don't have a Mac or older IE versions to test).
In my app I also add these lines to avoid leaving the page if the user wrongly try to drag & drop to a "not" input file, as the browser will try to open the file leaving your current page. I know it's not the puporse of this library, but I put it here cause I think is related.
$(document).on("dragover drop", function(e) {
if (!$(e.target).is("input[type='file']")) {
e.preventDefault(); //don't navigate to file on drop (if the target isn't an input type file)
}
});
Is an almost global denied to all drag&drop events as my app doesn't need any of these except for the file inputs, you will need to adjust this in your app. Here another link that could help for that http://stackoverflow.com/a/32044456.
Hope it helps anybod
from bootstrap-filestyle.
Related Issues (20)
- Hi,clear method is not working when I submit form by ajax. HOT 1
- Input group breaking changes HOT 6
- Default value HOT 1
- Not working inside an ng-repeat HOT 1
- Update npm package HOT 2
- How it works? HOT 14
- Can not install latest version using npm HOT 1
- the new version doesn't work for me HOT 1
- Not working in HubSpot, filestyle is not a function error HOT 3
- TypeError: element.filestyle is not a function HOT 1
- what about required option? HOT 1
- Text option to change button text wrong HOT 1
- Bootstrap-filestyle doesn't work. I can't see font awesome. HOT 5
- Version 1.2.3 not published to NPM HOT 1
- only works on page refresh
- Clear method issue
- change event not triggered on drag & drop
- Cannot Retrieve Javascript this object onChange Event
- dragdrop doesnt work if loaded via ajax
- Change on htmlIcon / data-icon
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrap-filestyle.