Submitting form data with jQuery

Hi all,

I was wondering if anyone would be able to help me out here. I have written a script using PHP to allow a user a project I am working on to upload a file into a MySQL database using PHP.
I would now like to improve on this script, ideally using jQuery as I have used in the past. I would like to be able to submit the upload and show a success overlay without forcing the user to leave the page.

I have Googled around and only succeeded in confusing myself, it would be great if anyone could help me out here.

My form that I need to submit the contents of is below.


<h2>File Upload</h2>  

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" id="fileUpload">

	<div>
		<label for="upload">Upload File</label>
		<input type="file" name="upload" id="upload" />
	</div>
	<div>	
		<label for="desc">File Description</label>
		<input type="text" name="desc" maxlength="225" id="desc" />
	</div>
	<div>
		<label for="url">Site URL</label>
		<label for="url" class="sameline">http:// </label><input type="text" name="url" maxlength="200" id="url" />
	</div>
	
	<div class="buttons">
		<input type="submit" id="submit" value="Upload" class="upload" />
	</div>

</form>

Any help would be awesome!

Thanks,
Dan.

If you don’t want to reload the page, but want to submit data to a database, you’re gonna need to look at the Ajax section of the jQuery site.
http://docs.jquery.com/Ajax