Comments (2)
#208 look this , it worked for me .🙂
from reqwest.
This should me marked as closed. Jquery's Ajax will work because it handles sending files for you. It will start with the latest API's like FormData and work all the way down to submitting the form in an iFrame.
Reqwest and any other Ajax function or API that relies on the traditional XMLHttpRequest can not submit forms that include files. When using ajax (or XMLHttpRequest really) you are responsible for preparing the forms data to send, usually using a serialize function, but you can not do that to a file; meaning you can not serialize a file for sending like you can with other inputs.
What you'll have to do is add a check to your code to see if the form attempting to be submitted has a file input in it. If so you must not try to send it with reqwest but instead use your own custom code to copy the form into an iframe and submit it hidden form the user. You then copy the iframes content after the submission and that becomes your response form the server. This is terribly complicated so I recommend searching Stack Overflow and blogs for help. Also, just FYI the "response" you get back from the iFrame is limited in the data (information) you'll get back. You wont have access to the whole XMLHttpRequest response for example.
from reqwest.
Related Issues (20)
- Setting contentType to application/json leads to session cookie not being sent HOT 1
- Setting content-type to 'application/json' on POST seems to be broken HOT 2
- context undefined when using webpack HOT 8
- reqwest 404 Request Method:OPTIONS
- Uncaught TypeError: Cannot read property 'responseText' of undefined
- if ajax return empty string ,the success function first param type will become "XMLHttpRequest" HOT 1
- How to abort a request? HOT 1
- Incorrect handling of response data
- reqwest promise with Nock HOT 1
- in IOS/Android webview, CORS, reqwest run error
- cache
- when I use reqwest post file,there is error: nested exception is java.lang.NullPointerException
- No err was throwed when network disconnected
- Ability to disable TLS at compile time? HOT 1
- CORS error when trying to get google geocoding HOT 4
- not support more than 16 integer data in response data
- how can i get response head HOT 3
- Type settings jsonp, jsonpCallback and jsonpCallbackName are not added, there will be default callback? HOT 1
- greenhouse 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 reqwest.