function constant_contact_import_submit in Constant Contact 6.3
Same name and namespace in other branches
- 5 constant_contact.module \constant_contact_import_submit()
- 6 constant_contact.module \constant_contact_import_submit()
- 7.3 admin.import.inc \constant_contact_import_submit()
Submit handler for the module import page
File
- ./
admin.import.inc, line 57
Code
function constant_contact_import_submit($form, &$form_state) {
$cc = constant_contact_create_object();
if (!is_object($cc)) {
return;
}
$status = false;
$lists = $form_state['values']['lists'];
$status = false;
if (isset($_FILES['files']['tmp_name']['file']) && is_uploaded_file($_FILES['files']['tmp_name']['file'])) {
$status = $cc
->create_contacts($_FILES['files']['tmp_name']['file'], $lists);
}
else {
drupal_set_message(t('The uploaded file is invalid please try again'), 'error');
return;
}
if ($status) {
drupal_set_message(t('An import activity has been created and will be completed soon'));
}
else {
drupal_set_message(t('Your subscribers could not be imported: ' . $cc->last_error), 'error');
}
}