In formdata anhängen Objekt zeigt leer.Formdata-Objekt zeigt leer auch nach Aufruf von append
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
var formy = new FormData();
formy.append("file", $("#file")[0].files[0]);
console.log(formy);
});
});
</script>
</head>
<body>
<input id="file" type="file" size="40"><br><br>
<button>Send an HTTP POST request to a page and get the result back</button>
</body>
</html>
Die Ausgabe des obigen Code in das Konsolenprotokoll gibt mir
Formdata{}
append:function append()
arguments:null
caller:null
length:2
name:"append"
während console.log($("#file")[0].files[0])
mich {name: "document.pdf", lastModified: 1462959300000, lastModifiedDate: Wed May 11 2016 15:05:00 GMT+0530 (IST), webkitRelativePath: "", size: 5275…}
Warum hängen Sie ist für Formulardaten nicht funktioniert ergibt Datei?
auch das funktioniert nicht. Ich bekomme immer noch Formdata {} –
@KanikaMidha lassen Sie mich wissen, wenn Sie noch Probleme haben. :) –