Take the 2-minute tour ×  I am trying to upload a file using
ajax. Can I upload the file using this method? I am currently
only getting the file name.  $(document).ready(function() {
$("#uploadbutton").click(function() {         var filename =
$("#file").val();         type: "POST",         url:
"addFile.do",            enctype: 'multipart/form-data',
data: {file: filename},           success: function(){
alert( "Data Uploaded: "); share|improve this question No you
can't do that way... What is #file? –  Chuck Norris Nov 29 '11
at 8:31 add comment  1 Answer  You can't do like this, Please
refer the below URL..It will help you, You can also implement
with Progress bar.   share|improve this answer add comment  Your
Answer