Page 1 of 1

please help with the jquery upload

Posted: Sat Nov 07, 2009 9:41 am
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

Re: please help with the jquery upload

Posted: Sat Nov 07, 2009 4:12 pm
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.

Re: please help with the jquery upload

Posted: Sat Nov 07, 2009 9:22 pm
by josh
You could just post the form, couldn't you? As in trigger the submit() action?