View Full Version : ajaxFileUpload with jQuery Form validation input text help

10-18-2009, 11:59 PM
Hi, For the last few days been tring to design jQuery Form validation text box with ajax upload

Basic I'm trying to input text in a text box and upload a file. On the back end file it check the database to see if Lastname has already been enter, If the username hasn't been add, it then insert to the the datebase with the new username and uploads the image as well.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<script type="text/javascript" src="http://www.phpletter.com/contents/ajaxfileupload/ajaxfileupload.js"></script>
<script type="text/javascript">

//errorLabelContainer: "#messageBox",
//wrapper: "li",
rules: {
username : {
required: true,
minlength: 5,
remote: {
url: "test13.php",
type: "post",
data: {
type: "text",
username : function() { return $("#username ").val()},


messages: {
username : {
required: "Please provide a username",
minlength: "Your username must be at least 5 characters long",
remote: jQuery.format("Sorry but '{0}' has already been selected. Please try again.")
submitHandler: function(form) {
dataType: 'json''

return false;


<ul id="messageBox"></ul>

<form id="myform" action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="fileframe" value="true">
<label> username </label>
<input name="lname" id="username " title="Your username , please!" class="required" />
<input type="file" name="fileToUpload" id="fileToUpload" class="input">
<br />
<input type="submit" value="Submit"/>



10-19-2009, 06:11 PM
What does the code above do? Is it online anywhere we can see it?

10-20-2009, 05:30 AM
Never mind, I fingered it out another way. :thumbsup: