$_FILES empty when submitting form via AJAX
Hi all,
I've got a weird issue here, hoping someone can shed some light on potential causes.
I have a page which triggers a lightbox when a certain link is clicked. The lightbox contains a Drupal form with a textfield and a file upload field. When the form submit button is clicked, the form is submitted via AJAX to mysite.com/callback. The callback function is simply this:
<?php
function pbu_temp_submit()
{
print_r($_FILES);
exit();
}
?>The output is always an empty array. (I see the output through Firebug's console window.)
If I remove the JavaScript code which assigns the AJAX submit to this form, the output properly contains my uploaded file.
The worst part is that this functionality was working 100% fine until recently. Something on the site changed (it's being worked on by multiple developers) and I've had no luck in finding what.
Any suggestions on what could be causing this?
Thanks!
If it helps, here is the associated JavaScript:
<?php
addEventFormHandler: function()
{
$(pbu_e.form_upload).submit(function()
{
$(pbu.throbber).addClass('active');
var options = {
success: function(data)
{
$(elements.add_event_target).html(data);
console.log('here');
/*
$.ajax({
type: "POST",
url: site_base_path + 'parentella/update_events_view/' + $('#edit-cnid').attr('value'),
success: function(view)
{
$('#content-area').html(view);
}
});
*/
$(pbu.throbber).removeClass('active');
}
};
$(this).ajaxSubmit(options);
return false;
});
}
?>
Okay, I finally got this
Okay, I finally got this solved. Another developer had moved code around in one of the modules this module depends on and some javascript was getting messed up. Argh!
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials
Frosty Orange 6.x Theme: http://www.yubastudios.com/product/frosty-orange