Skip to content

Instantly share code, notes, and snippets.

@pawellenart
Created September 15, 2011 20:22
Show Gist options
  • Save pawellenart/1220366 to your computer and use it in GitHub Desktop.
Save pawellenart/1220366 to your computer and use it in GitHub Desktop.
function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader'),
action: '../include/upload/upload.php',
debug: false,
onSubmit: function() {
$("#su_name, #su_company, #su_project, #su_email").css('border', '0');
if ($("#su_name").val() == "" ||
$("#su_company").val() == "" ||
$("#su_project").val() == "" ||
$("#su_email").val() == "") {
$("#su_name, #su_company, #su_project, #su_email").each(function() {
if ($(this).val() == "") {
$(this).css('border', '1px solid red');
}
});
alert("You have to fill out all of the details before uploading files.");
return false;
}
else {
setParams({
name: $('#su_name').val(),
company: $('#su_company').val(),
project: $('#su_project').val(),
email: $("su_email").val()
});
return true;
}
},
onComplete: function() {
$("#su_name, #su_company, #su_project, #su_email").css('border', '0').val('');
$('ul.qq-upload-list').fadeOut('slow', function() {
$(this).html('').show(); // poof! a magic trick!
});
}
});
}
window.onload = createUploader;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment