Two (or more) module in page
-
Hi all.
I have insert a two donation modules in my home page and add a custom field (upload file) on both module.
All work fine except the upload file on second module!
On submit the field check work fine but the file is not upload in my site.
This is the code from save custom fields.
The $_FILES[‘fileToUpload’][‘name’] is empty for second module but work for the first modulefunction give_mamafrica_donations_save_custom_fields( $payment_id ) { if (!empty($_FILES['fileToUpload']['name'])) { $timestamp = time(); $userfile_name = $timestamp . "-" . $_FILES['fileToUpload']['name']; error_log("6"); error_log($userfile_name); //$message = wp_strip_all_tags( $_FILES['fileToUpload']['name'], true ); $message = wp_strip_all_tags($userfile_name, true ); give_update_payment_meta( $payment_id, 'fileToUpload', $message ); //percorso della cartella dove mettere i file caricati dagli utenti $uploaddir = get_stylesheet_directory() . '/offline_donation/'; //Recupero il percorso temporaneo del file $userfile_tmp = $_FILES['fileToUpload']['tmp_name']; //recupero il nome originale del file caricato //copio il file dalla sua posizione temporanea alla mia cartella upload if (move_uploaded_file($userfile_tmp, $uploaddir . $userfile_name)) { //Se l'operazione è andata a buon fine... echo 'File inviato con successo.'; }else{ //Se l'operazione è fallta... echo 'Upload NON valido!'; } } } add_action( 'give_insert_payment', 'give_mamafrica_donations_save_custom_fields' );Can you help me?
Regards,
Marco- This topic was modified 5 years, 11 months ago by .
- This topic was modified 5 years, 11 months ago by . Reason: please use CODE button for code formatting
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Two (or more) module in page’ is closed to new replies.