पर अज्ञात में बहुखण्डीय/फार्म-डेटा पोस्ट डेटा में सीमा गुम यह मेरा जावास्क्रिप्टphp संदेश चेतावनी: लाइन 0
function ajax_post(){
// Create our XMLHttpRequest object
var hr = new XMLHttpRequest();
// Create some variables we need to send to our PHP file
var url = "LiveUpdate.php";
var sb = document.getElementById("LiveUpdate").value;
var FirstName = document.getElementById("FirstName").value;
var images = document.getElementById("images").value;
var vars = "update="+sb+"&FirstName="+FirstName+"&images="+images;
hr.open("POST", url, true);
// Set content type header information for sending url encoded variables in the request
hr.setRequestHeader("Content-type", "multipart/form-data");
// Access the onreadystatechange event for the XMLHttpRequest object
hr.onreadystatechange = function() {
if(hr.readyState == 4 && hr.status == 200) {
var return_data = hr.responseText;
document.getElementById("message").innerHTML = return_data;
}
}
// Send the data to PHP now... and wait for response to update the status div
var formData = new FormData(document.querySelector("form"));
hr.send(formData); // Actually execute the request // Actually execute the request
document.getElementById("message").innerHTML = "processing...";
}
//show image before uploading
var loadFile = function(event) {
var output = document.getElementById('output');
output.src = URL.createObjectURL(event.target.files[0]);
};//end image
है और इस रूप है। जावास्क्रिप्ट और फॉर्म एक ही फाइल में है। फ़ाइल का नाम sample.php
<form action="popup.php" method="post" id="myForm" name="myForm" enctype="multipart/form-data">
<div id="message"></div>
<img src="" id="output" />
<input type="file" class="filestyle" data-buttonBefore="true" accept=".png, .jpg, .jpeg" onchange="loadFile(event)" name="images" id="images">
<input class="form-control" type="text" placeholder="First Name" name="FirstName" id="FirstName" value="">
<a href="#" class="btn btn-success" role="button" name="update" id="LiveUpdate" onclick="javascript:ajax_post();">Update</a>
</form>
इस कोड में विचार है। मैं पृष्ठ को रीफ्रेश किए बिना डेटाबेस लाइव में फर्स्टनाम और छवि जैसी बुनियादी जानकारी डालना चाहता हूं। मैं AJAX जमा करने के लिए टैग क्यों चुनता हूं। तो पेज url account.php? संपादित करें = 1 account.php में नहीं बदलेगा क्योंकि अगर यह account.php में बदल जाता है तो पॉपअप संपादन मोड बंद हो जाएगा। इस कोड में समस्या है। मुझे नहीं पता कि त्रुटि Warning: Missing boundary in multipart/form-data POST data in Unknown on line 0
त्रुटि को कैसे ठीक किया जाए, कोई भी इसे ठीक करने में मेरी सहायता कर सकता है। धन्यवाद!
संभव डुप्लिकेट [चेतावनी: मल्टीपार्ट/फॉर्म-डेटा में लापता सीमा लाइन 0 पर अज्ञात में पोस्ट डेटा] (http://stackoverflow.com/questions/27635738/warning-missing-boundary-in-multipart-form-data-post- डेटा-इन-अज्ञात-ऑन-लाइन -0) –