What Is The Alternative Of Formdata In Ios?
I'm using xmlHTTPRequest (and also $.ajax) to send a form(that contain some text inputs and multi-file input) without refreshing the page. I'm using FormData to send the form succe
Solution 1:
I was able to use FormData with Safari on iOS 10.3.3 (iPhone 5C) like so:
var formData = newFormData(document.getElementById('form1'));
var xhr = newXMLHttpRequest();
xhr.onreadystatechange = function(event) {
if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
// do something
} else {
// do something
}
// clean
xhr = null;
}
}
xhr.open('post', 'http://server/upload.php', true);
xhr.send(formData);
<formid="form1"action="upload.php"method="POST"enctype="multipart/form-data"><labelid="bChoose"for="file">Choose</label><inputid="file"type="file"name="file" /></form>
Post a Comment for "What Is The Alternative Of Formdata In Ios?"