Script catching image

Slurpgeit

New Member
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.\[code\]<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>\[/code\]Here is my form\[code\]<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="http://stackoverflow.com/questions/12773277/Upload" id="Submit"></td> </tr></table></form>\[/code\]How can I change the script so I can upload a form that also has a file upload??
 
Back
Top