Upload file with ajax and jquery.save image on server in C# code.
<p>i want to create a fileupload with ajax and jquery.i send formData to server.i can not get data and save image on server.
it is my code in javascript:</p>

<pre><code>function UploadFile() {
         var fileName = $('#uploadFile').val().replace(/.*(\/|\\)/, '');
         if (fileName != "") {
             var formData = new FormData();

             formData.append('file', $('input[type=file]')[0].files[0]);
             $.ajax({
                 url: 'p1.aspx/uploadPic',
                 data: formData,

                 processData: false,
                 contentType: false,
                 type: 'POST',
                 success: function (dt) {
                     alert(dt.d);
                 }
             });
             }
     }
</code></pre>

<p>code in p1.aspx page:</p>

<pre><code>[WebMethod]
public static string uploadPic(HttpPostedFile file)
{
 return file.FileName;
}
</code></pre>

<p>it is not work and not return any thing!what is wrong?how can get image on server?
best reagrds.</p>