Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-31-2011, 11:47 AM   PM User | #1
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
[JQuery] Get files using ajax!

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?

Last edited by Kor; 03-31-2011 at 01:13 PM.. Reason: Move the Thread in the proper Forum and adding a descriptive prefix
sorlaker is offline   Reply With Quote
Old 04-01-2011, 08:29 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Take a look at "jQuery File Upload" on http://aquantum-demo.appspot.com/file-upload
devnull69 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:57 PM.


Advertisement
Log in to turn off these ads.