Comments (12)
In knockout-file-bindings.js, in fillDataToProperty, I made the following change to be able to match the fileArrary with the base64String Array:
function fillDataToProperty(result, prop) {
if (index == 0 && fileData[prop] && ko.isObservable(fileData[prop])) {
fileData[prop](result);
}
if (fileData[prop + 'Array'] && ko.isObservable(fileData[prop + 'Array'])) {
if (!file.id) {
file.id = result;
}
fileData[prop + 'Array'].push(result);
}
}
from knockout-file-bindings.
Reasonable, I ended up writing my own alternative ko binding extension for file upload and drag&drop
from knockout-file-bindings.
@safrazik , could you implement the changes into the library, and check the pull request that resolves another issue?
from knockout-file-bindings.
@DrJam , I still use this component and this still an issue for us. Is your alternative version available? Does it differ far from the original? Or do you know what to change in the knockout-file-binding.js to get this solved? I can see that the fix by michaeldeongreen above is implemented but it does not seem to be a complete solution.
from knockout-file-bindings.
@Dizzitune I’m the author of the component. It's interesting to know that the component is still used today. I already looked into this issue few years back and gave up in fear of breaking anything else that is working already, and of course, lack of time. I think I could give another shot now as I have more experience in this particular area, especially after my Vue File Agent component. I’m working on FileAgent v2 With support for React, Vue and vanilla JS.
https://github.com/safrazik/vue-file-agent
I assume using Promise.all
would be ideal to fix this issue. Are you using any Promise poly fill already?
from knockout-file-bindings.
@safrazik - I tried debugging the code myself but it was a bit difficult to find the cause of the issue. If you have time to fix it or if you could point me in the right direction it would be very appreciated :) Promise.all would not be a problem.
from knockout-file-bindings.
@Dizzitune Version 1.2.0 fixes this issue. Please test and confirm with your test cases.
from knockout-file-bindings.
@safrazik Yes! Works like a charm, thank you very much :)
It would be nice to do Vue, Blazor or something newer than 2014 sometime but some of us just have to stick to the dirty work ;) KO Rules!
from knockout-file-bindings.
@Dizzitune I am in the process of moving from KO to Vue. I like Vue a lot better. Vue 3's reactivity is very similar to KO. KO was way ahead of its time on the reactivity aspect but way behind the times wrt components and virtual dom.
Once Vue 3 is out and vuetify ports over to Vue 3, then I would wholeheartedly suggest that you move over to Vue 3 and Vuetify.
I am finding that with KO I ended up copy and pasting stuff all over the place because of the lack of good component support. But with Vue, I am writing reusable components that I use many times. In the end it is much faster with Vue. I am converting as I go so that I no longer build KO UIs and my app is a mixture of the two.
from knockout-file-bindings.
Yes indeed. I've worked with Vue some time and its great and of course a lot more powerful than KO. I think KO was just outstanding when it arrived and therefore we have a lot of old applications that are based on KO and in need of maintenance. Soo thats why this was relly helpful.
With KO I’ve added some features to the KO Component base and developed support for distributed system. So we have distributed KO Components that can be used like GUI-composition in other applications. At this point (a lot of coding) its quite easy to use.
To be honest I’m quite tired of Javascript today and hoping for some development including Webassembly and Blazor. We will see :)
from knockout-file-bindings.
Yea, I hate javascript. I only use typescript. The difference might seem small but it is really huge. I don't know how people can ship a bug free product in javascript, but with typescripts type system, and the refactoring tools that a type system provides, I feel much more confident with the quality of my front end.
from knockout-file-bindings.
Typescript is what we are using too but its still a lot of issues. Webassembly allow us to use c# native on client and server and that would be soo nice :)
from knockout-file-bindings.
Related Issues (20)
- Way to disable ability to change picture after it has been selected? HOT 1
- Initial Data HOT 1
- Feature request: handle file inputs with `multiple` attribute
- Bower package HOT 1
- Get rid of jQuery dependence HOT 1
- Issue loading data URL from server into file input HOT 3
- fileName option is not respected HOT 1
- Remove objectURL support as it is experimental
- CDN + TypeScript TypeDefintion HOT 1
- Object does not support method 'split' HOT 4
- Object does not support method 'readAsBinaryString' HOT 2
- Feature request: get notified when ALL properties are up to date HOT 10
- Some way for restrict file types HOT 2
- Issues with size of file being uploaded HOT 1
- base64StringArray Size HOT 9
- maxfilesize param HOT 2
- How to Initialize the knockout-file-upload. HOT 3
- Preview PDF HOT 1
- Drag Drop pdf file always base64string, arrayBuffer & dataURL return null HOT 1
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 knockout-file-bindings.