Comments (3)
@sonicparke I don't think it will work with those directives, because I think ng-submit overrides the traditional form post and enables you to submit via ajax, the same with ng-click. Inorder for this solution to work, it needs to do a plain ole form post to the server with the multipart header, the it creates an iframe for the response back, so that it does not create a page request. You may be able to use ng-click with a reference to the form element and triggering the submit event, but I have not tried that approach.
If you do not need to support older browsers you could try an approach like this one
https://gist.github.com/twilson63/5471450
This solution use the FormData API to send files, but it is not supported by IE 8 or IE 9, I believe...
Still working out how I can combine the two methods without creating a mess. Open to suggestions.
Thanks
Tom
from ngupload.
Thanks, Tom. At the moment I don't really need to support older browsers because I'm forcing Chrome Frame on them. It's an internal app so I have that flexibility. However, as I run up against the need to put this functionality into more apps I may not have that luxury.
So really I think I need to figure out 2 things.
- How to reference the form element and trigger the submit event
- How to replace the call to attr.action int the FormData API solution and call my function in the controller.
This is good. It is stretching my Angular muscles. I'm just getting into directives and there's still a lot of learning to do.
If I come up with any ideas on how to merge the two I'll let you know. It could be as simple as relying on modernizr to tell you if you can use the FormData API or not. But then that doesn't fix the way you call it in the html.
Thanks,
Brad
from ngupload.
Hey Brad,
Awesome! Totally agree.
The thing I am struggling with trying to combine both approaches is the
following:
ngUpload works in a declarative way, you define the form and let the
directive consume it, so lets detect and swap out to form data if possible,
and I did experiment with this working with the Mozllia examples.
https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/FormData/Using_FormData_Objects
But, for some reason, I could not get FormData to consume the form and all
its elements, but I was able to get it to work by explicitly attaching each
element to the formdata object.
Where I hit a dead end was the amount of effort to grap all form elements
and iterate through them attaching the values of each one to the form data
object. Just did not seem like the right path, but I have not had time to
research why the consume the form approach did not work.
If you get any ideas, I would love to hear about them.
Thanks
Tom
On Fri, May 10, 2013 at 10:01 AM, Brad McAlister
[email protected]:
Thanks, Tom. At the moment I don't really need to support older browsers
because I'm forcing Chrome Frame on them. It's an internal app so I have
that flexibility. However, as I run up against the need to put this
functionality into more apps I may not have that luxury.So really I think I need to figure out 2 things.
- How to reference the form element and trigger the submit event
- How to replace the call to attr.action int the FormData API solution
and call my function in the controller.This is good. It is stretching my Angular muscles. I'm just getting into
directives and there's still a lot of learning to do.If I come up with any ideas on how to merge the two I'll let you know. It
could be as simple as relying on modernizr to tell you if you can use the
FormData API or not. But then that doesn't fix the way you call it in the
html.Thanks,
Brad—
Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-17721753
.
Tom Wilson
Jack Russell Software Company Division of CareKinesis
494 Wando Park Blvd
Mount Pleasant, SC 29464
Phone: 843-881-2171
Email: [email protected]
Web: http://www.jackhq.com
Calendar:
http://www.google.com/calendar/embed?src=tom%40jackrussellsoftware.com&ctz=America/New_Yorkhttp://www.jackhq.com/calendar
This e-mail may contain information that is confidential, privileged or
otherwise protected from disclosure by the Health Insurance Portability and
Accountability Act (HIPAA) and other state and federal laws. This
information is intended only for the individual names above. Any review,
use disclosure or dissemination of this material is strictly prohibited.
If you receive this information in error, please notify CareKinesis
immediately at 888-974-2763 and delete the original at once.
from ngupload.
Related Issues (20)
- ngUpload not working on Firefox 27 Mac - returns HTML instead of JSON
- getting a warning in console
- How to prefix file name that is uploaded HOT 10
- Minified version causing form submitted multiple times HOT 7
- 404 not found HOT 2
- Error handling HOT 6
- Setting custom headers HOT 8
- Auto start upload HOT 3
- custom headers using CORS in IE8 HOT 1
- Minified file not updated HOT 1
- $isLoading should be $isUploading in the readme HOT 1
- ng-upload executing multiple times
- ngUpload is not working HOT 3
- ng-upload.min.js is broken HOT 2
- How can we implement the progress bar for ngUpload? HOT 2
- Bower package is out-of-date HOT 3
- Hidden inputs do not work for objects
- Can we get upload percent in $scope? HOT 1
- BeforeSumbit executes after submit
- Is it possible to register the package on npm? HOT 2
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 ngupload.