View Full Version : [JQuery] Get files using ajax!

03-31-2011, 11:47 AM
How can i get the file using jquery ajax?

body index

<div id="content"></div>
<input type="file" id="file" name="thefile" size="10"/>
<input id="uploadbutton" type="button" value="Upload"/>


$(document).ready(function() {
$("#uploadbutton").click(function() {
var filename = $("#file").val();
type: "POST",
url: "upload.php",
data : {file : filename},
success: function(lol){


upload.php file

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?

04-01-2011, 08:29 AM
Take a look at "jQuery File Upload" on http://aquantum-demo.appspot.com/file-upload

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum