Hello,
I wonder is there a popup contact form with a possibility to submit files in a template and if yes, where is it? I have been searching for a while, but didn't manage to find it. Thanks
19 replies · opened Nov 30, 2017
Hello,
I wonder is there a popup contact form with a possibility to submit files in a template and if yes, where is it? I have been searching for a while, but didn't manage to find it. Thanks
Hello,
The Template: contact-5-file.html will work fine for this.
Hope this Helps!
Let us know if we can help you with anything else or if you find any further issues.
I have made a contact form, thank you, but is there a possibility to make a multiple file upload? It would be perfect if there was only one submit button and it was possible to add many files.
And one more question on the contact form, I place the contact form button in a "call to action" section. Since I have several sections on a page I have an error, duplicate ID (#reviewFormModal). Making several IDs would be very uncomfortable. Is there a possibility to put some other selector? I tried with "class", but it loads several forms on a page at the same time.
Hello,
if ( isset( $_FILES['template-contactform-file'] ) && $_FILES['template-contactform-file']['error'] == UPLOAD_ERR_OK ) {
$mail->IsHTML(true);
$mail->AddAttachment( $_FILES['template-contactform-file']['tmp_name'], $_FILES['template-contactform-file']['name'] );
}and replace it with:
for( $ct = 0; $ct IsHTML(true);
$mail->addAttachment( $uploadfile, $filename );
}
}Additionally, in the HTML, find the following code:
and replace it with:
This will definitely work fine. Hope this Helps!
Let us know if we can help you with anything else or if you find any further issues.
Can you please take a look, I have removed the form data (the button "Отправить заявку") https://speak-time.com/
I don't have duplicate ID on this page anymore. However, the form is working fine.
But I don't manage to make the same trick here https://speak-time.com/ustnyij-perevod
(the button is the same, the form is slightly different).
What can I do, because making a different id every time I create a new call to action page would create a terrible mess, because there will be over 50 pages in this web site.
Is it possible to make it like this?
you don't have to reply the last two messages, I have found out how to do this)
and thank you very much for your help!
I did as you wrote with the contact form but I still can upload only one file. The form sends only the last one.
Hello,
We have just checked out the codes and it appears to be working fine for us. Please make sure that the File Input's name Attribute value is correct. It should be: template-contactform-file[] with the [] to handle multiple files.
Hope this Helps!
Let us know if we can help you with anything else or if you find any further issues.
Do you mean that I need to create several input fields to attach several files? Because now it sends only one file. And is it possible to make a redirect to the "thank you" page after the form submission?
Hello,
You do not have to create multiple File Inputs. Can you please provide us with a Live URL and also your include/sendemail.php File via email so that we can check out the exact issues and provide you with more assistance on this. Thanks for your Patience.
Additionally, you can simply add the data-redirect="http://your-website.com/thank-you.html" Attribute to the .contact-widget Element
Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.
Ok, here is the link
https://speak-time.com/pismennyij-perevod-tekstov-na-zakaz
The form button is "ОТПРАВИТЬ ЗАЯВКУ"
The sendmail file is called formpism.php. I just copied everything from the original form.
I didn't manage to attach a php file, so I changed it for txt. but it is the same file
Hello,
Thanks for your Patience! We are looking into this and reply to you shortly.
Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.
Hello,
Please consider using the following code replacing the Previous Code:
for( $ct = 0; $ct addAttachment( $uploadfile, $filename );
}
}This should definitely work fine. Hope this Helps!
Let us know if we can help you with anything else or if you find any further issues.
Hi! First, thanks for your help. Eventually I tried the other form but now I found that it ha some conflict with the template so I must use your form. I tried the last option, it didn't work. The my form I have:
'info@speak-time.com', // Your Email Address
'name' => 'Your Name' // Your Name
);
// Form Processing Messages
$message_success = 'We have **successfully** received your Message and will get Back to you as soon as possible.';
// Add this only if you use reCaptcha with your Contact Forms
$recaptcha_secret = ''; // Your reCaptcha Secret
$mail = new PHPMailer();
// If you intend you use SMTP, add your SMTP Code after this Line
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
if( $_POST['template-contactform-email'] != '' ) {
$name = isset( $_POST['template-contactform-name'] ) ? $_POST['template-contactform-name'] : '';
$email = isset( $_POST['template-contactform-email'] ) ? $_POST['template-contactform-email'] : '';
$phone = isset( $_POST['template-contactform-phone'] ) ? $_POST['template-contactform-phone'] : '';
$service = isset( $_POST['template-contactform-service'] ) ? $_POST['template-contactform-service'] : '';
$subject = isset( $_POST['template-contactform-subject'] ) ? $_POST['template-contactform-subject'] : '';
$message = isset( $_POST['template-contactform-message'] ) ? $_POST['template-contactform-message'] : '';
$subject = isset($subject) ? $subject : 'New Message From Contact Form';
$botcheck = $_POST['template-contactform-botcheck'];
if( $botcheck == '' ) {
$mail->SetFrom( $email , $name );
$mail->AddReplyTo( $email , $name );
foreach( $toemails as $toemail ) {
$mail->AddAddress( $toemail['email'] , $toemail['name'] );
}
$mail->Subject = $subject;
$name = isset($name) ? "Name: $name
" : '';
$email = isset($email) ? "Email: $email
" : '';
$phone = isset($phone) ? "Phone: $phone
" : '';
$service = isset($service) ? "Service: $service
" : '';
$message = isset($message) ? "Message: $message
" : '';
$referrer = $_SERVER['HTTP_REFERER'] ? '
This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';
$body = "$name $email $phone $service $message $referrer";
// Runs only when File Field is present in the Contact Form
for( $ct = 0; $ct IsHTML(true);
$mail->addAttachment( $uploadfile, $filename );
}
}
// // Runs only when reCaptcha is present in the Contact Form
// if( isset( $_POST['g-recaptcha-response'] ) ) {
// $recaptcha_response = $_POST['g-recaptcha-response'];
// $response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=" . $recaptcha_secret . "&response=" . $recaptcha_response );
// $g_response = json_decode( $response );
// if ( $g_response->success !== true ) {
// echo '{ "alert": "error", "message": "Captcha not Validated! Please Try Again." }';
// die;
// }
// }
// Uncomment the following Lines of Code if you want to Force reCaptcha Validation
// if( !isset( $_POST['g-recaptcha-response'] ) ) {
// echo '{ "alert": "error", "message": "Captcha not Submitted! Please Try Again." }';
// die;
// }
$mail->MsgHTML( $body );
$sendEmail = $mail->Send();
if( $sendEmail == true ):
echo '{ "alert": "success", "message": "' . $message_success . '" }';
else:
echo '{ "alert": "error", "message": "Email **could not** be sent due to some Unexpected Error. Please Try Again later.
**Reason:**
' . $mail->ErrorInfo . '" }';
endif;
} else {
echo '{ "alert": "error", "message": "Bot **Detected**.! Clean yourself Botster.!" }';
}
} else {
echo '{ "alert": "error", "message": "Please **Fill up** all the Fields and Try Again." }';
}
} else {
echo '{ "alert": "error", "message": "An **unexpected error** occured. Please Try Again later." }';
}
?>And in the HTTML code I have:
Ваше имя
*
Email
*
Язык перевода
*
Прикрепить файл
Отправить
This combination attaches the files successfully but only one file for one button, and also there is a problem when a user use cyrillic letters, in the form I have something like ÐлекÑа
Is it possible to do anything about that? I would really appreciate youк help.
Hello,
Can you please consider checking out this code: http://www.w3bees.com/2013/02/multiple-file-upload-with-php.html .
Simply add the $mail->CharSet = 'utf-8'; just before $mail->MsgHTML( $body ); Line of Code.
This will definitely work fine. Hope this Helps!
Let us know if we can help you with anything else or if you find any further issues.
This doesn't work either:(
However, I managed to make 3 upload buttons that senf 3 files, which works fine.
But there is still the questions:
This one doesn't deem to work
$valid_formats = array("jpg", "png", "gif", "zip", "bmp");
$max_file_size = 1024*100; //100 kb
$path = "uploads/"; // Upload directory
$count = 0;
Have the same question, or something new?
Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.
Reply on the dashboard