Created
July 3, 2011 20:36
-
-
Save tim-kos/1062581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" type="text/css" href="http://assets.transloadit.com/css/transloadit2.css" /> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
var bypassValidationAndTlBinding = false; | |
$("#MyForm").submit(function( e) { | |
if (!bypassValidationAndTlBinding) { | |
if( $("#firstname").val() != "dan" ) { | |
alert("the name is not dan"); | |
e.preventDefault() | |
} else { | |
alert("form is valid... now how come there is no progress bar after you hit ok? it still seems to upload to S3 though..."); | |
e.preventDefault() | |
$("#MyForm").transloadit({ | |
wait: true, | |
}); | |
bypassValidationAndTlBinding = true; | |
$('#MyForm').submit(); | |
} | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h2>This should only submit if you enter dan in the FirstName textbox.</h2> | |
<?php | |
$params = array( | |
'auth' => array('key' => 'YOUR KEY'), | |
'template_id' => 'TEMPLATE_ID' | |
); | |
?> | |
<form id="MyForm" action="http://mydomain.com/transloadit.post.php" enctype="multipart/form-data" method="POST"> | |
<input type='hidden' name='params' value="<?php echo htmlentities(json_encode($params)) ?>" /><br /> | |
FirstName: <input type="text" name="firstname" id="firstname" ><br /><br /><br /> | |
<input type="file" name="my_file" /><br /><br /> | |
<input type="submit" value="Submit" id="submitform"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment