How can i get the file using jquery ajax?
body index
Quote:
<div id="content"></div>
<input type="file" id="file" name="thefile" size="10"/>
<input id="uploadbutton" type="button" value="Upload"/>
|
js
Quote:
$(document).ready(function() {
$("#uploadbutton").click(function() {
var filename = $("#file").val();
$.ajax({
type: "POST",
url: "upload.php",
data : {file : filename},
success: function(lol){
$('#content').html(lol);
}
});
});
});
|
upload.php file
Quote:
|
echo $_FILES['file']['name'];
|
i can't deal with that red line code.
the php file only outputs : "Undefined variable: file in C:\wamp\www\upme\upload.php on line 4"
can u help me?