脚本捕获图像

I have this script,so it goes to ../AdsCreate/CreateCar.php reads the form and inserts into databse and loads page into a certain div which all works fine.

I have one problem one part of the form is to upload an image,now that it does not do I have been told it's because that script below serialize the data and does not do that for file based.

Here is the script.

<script type="text/javascript">
jQuery(document).ready(function($) {

$("#Submit").click(function() {

var url = "../AdsCreate/CreateCar.php"; // the script where you handle the form input.

$.ajax({
   type: "POST",
   url: url,
   data: $("#myForm").serialize(), // serializes the form's elements.
   success: function(html){ $("#right").html(html); }
 });

return false; // avoid to execute the actual submit of the form.
});
});
</script>

Here is my form

<form method="post" enctype="multipart/form-data" id="myForm">
 <table class="default1" style="width: 100%" align="center">
      <tr>
        <td class="content1" colspan="3"><h3><b>Car Ads</b></h3></td>
      </tr>
      <tr>
      <td class="content1" width="70%">Make: <input type="text" name="name"></td>
      <td class="content1" width="15%">Model: <input type="text" name = "email"></td>
      <td class="content1" width="15%">Year: <input type="text" name = "phone"></td>
     </tr>
      <tr>
      <td class="content1" colspan="3">Main Photo: <input type="file" name="photo"></td>
     </tr>
      <tr>
      <td class="content1" colspan="3"><input type="submit" value="Upload" id="Submit"></td>
     </tr>
</table>
</form>

How can I change the script so I can upload a form that also has a file upload??

You can upload file separately using this plugin:

http://blueimp.github.com/jQuery-File-Upload/

You can also use jQuery Forms to upload File:

http://www.malsup.com/jquery/form/#file-upload

Make sure to disable submit button once a file is selected so it will upload the image first before the user can submit the form.