please help with the jquery upload

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
jaisonjustus
Forum Newbie
Posts: 3
Joined: Thu Nov 05, 2009 10:52 pm

please help with the jquery upload

Post by jaisonjustus »

hai friends,

iam jaison justus, i need a help for uploading a file using jquery ajax. i dont need to use any jquery upload plugin.
the code is

$(document).ready(function(){
$('#addAlbum').click(function(){
alert('click test done!!!!');

details = $('#albumname').val();
details += ':';
details += $('#artistname').val();
details += ':';
details += $('#ratingval').val();
details += ':';
details += $('#image').val();
alert(details);
uploadDetails(details,$('#image').val());


});
});


function getElement(result) {
alert('done' + ' ' + result);
}

/*detail:details,image:imageFile*/

function uploadDetails(details,imageFile) {
$.ajax({
url:'uploadAlbum.php',
type: 'POST',
data: { detail:details,
image:imageFile
},
success: function(result){alert(result);}
});
}


this code is not working
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: please help with the jquery upload

Post by kaszu »

I assume $('#image') is an input with type "file".
Short answer is you can't do it and you need to use a plugin.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: please help with the jquery upload

Post by josh »

You could just post the form, couldn't you? As in trigger the submit() action?
Post Reply