Skip to content

Instantly share code, notes, and snippets.

@Lasha
Created August 20, 2012 06:15
Show Gist options
  • Save Lasha/3401523 to your computer and use it in GitHub Desktop.
Save Lasha/3401523 to your computer and use it in GitHub Desktop.
$(function() {
var uploadFileNames = '&';
$("#file_upload").uploadify({
'swf': '/uploadify/uploadify.swf',
'uploader': '/uploadify/uploadify.php',
'onUploadSuccess': function(file, data, response) {
alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
uploadFileNames += 'fileNames[]=' + file.name + '&';
},
'onQueueComplete': function(queueData) {
if (queueData.uploadsSuccessful && !queueData.uploadsErrored) {
var formData = $('#formIDHere').serialize();
$.ajax({
type: "POST",
url: "some.php",
data: formData + uploadFileNames;
}).done(function(data) {
if (console && console.log) {
console.log("Returned Data: " + data);
}
}).fail(function(jqXHR, textStatus) {
alert("Request failed: " + textStatus);
});
}
}
});
});​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment