File upload

File upload

Hey guys,

I have a form that uploads a file along with posts some other information. I would like this to happen without having to reload the page, but I am unsure how to do this in regards to the file upload. I read that it is only possible with some plugins, but I would like to hear your recommendations before messing around with it too much. Here is the relevant parts of my code:


submit.php
  1. <form method="post" id="submitContentForm" action="./php/submitContent.php" enctype="multipart/form-data">
  2.       <input type="text" name="serverName" id="serverName" size="24" /><br />
  3.       <textarea name="serverDescription" id="serverDescription"></textarea><br />
  4.       <input type="text" name="website" id="website" size="24" /><br />
  5.       <input name="uploadBanner" type="file" size="24" />
  6. </form>

submit.js
  1. $(function() {
  2.       function submitContent() {
  3.             var path = "php/submitContent.php";
  4.             var name = $('#serverName').val();
  5.             var descrip = $('#serverDescription').val();
  6.             var website = $('#website').val();

  7.             $.post(path, { serverName: name, serverDescription: descrip, website: website  }, function(result) {
  8.                   // Some code
  9.             });
  10.       }
  11.       $('#submitContentForm').submit(submitContent);
  12. });

So, I can post the server name, description and website, but how do I send the file over to the PHP script? Any recommendations? If you know an easy-to-use plugin, that would also be great, but I kindly ask you to provide an example of how I can use it since I am still kind of a rookie. 


Thank you in advance!