Comments on: Contact Form with Sending Email with Attachment in PHP https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/ Web & Mobile App Development Company Thu, 11 Sep 2025 11:26:03 +0000 hourly 1 By: Rod Foley https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-221834 Sun, 13 Nov 2022 08:49:26 +0000 https://www.codexworld.com/?p=3449#comment-221834 Hi, I am using the code above and tried your demo, however after I complete the form on my host-page and upload the file, click submit, I get the following messag on the form:

Sorry, there was an error uploading your file

I am uploading an accepted type .jpg – Can you please assist with why this is coming up?

Thanks,

Rod

]]>
By: CodexWorld https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-205415 Sat, 17 Sep 2022 04:56:42 +0000 https://www.codexworld.com/?p=3449#comment-205415 In reply to franco cazzola.

The PHP default mail() function will not work on localhost. You need to check the email functionality on the hosting server.

]]>
By: franco cazzola https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-204993 Thu, 15 Sep 2022 10:13:39 +0000 https://www.codexworld.com/?p=3449#comment-204993 Hi
I tried to use your source code contact-form on localhost.
I get this message:
Warning: mail(): Failed to connect to mailservfer al localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set()

Please, what can I do ?
Franco

]]>
By: solomon https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-183473 Wed, 15 Jun 2022 15:28:31 +0000 https://www.codexworld.com/?p=3449#comment-183473 How to stop refresh after submit

]]>
By: CodexWorld https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-175178 Tue, 10 May 2022 07:59:06 +0000 https://www.codexworld.com/?p=3449#comment-175178 In reply to Bill.

Yes, you need to specify the sender name in the $fromName variable and sender email in the $from variable.

]]>
By: Bill https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-175082 Mon, 09 May 2022 19:55:31 +0000 https://www.codexworld.com/?p=3449#comment-175082 I understand that the recipient is me, so I’d replace admin@example.com with my email address. But everyone who uses the form will have a different name and a different email address, so what would I replace sender@example.com with in the $from entry and CodeWorld with in the $fromName entry?

]]>
By: Pratik https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-153387 Wed, 06 Oct 2021 05:42:41 +0000 https://www.codexworld.com/?p=3449#comment-153387 Hi,

How do I add file size limit to attachment?

Kindly suggest.

]]>
By: CodexWorld https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-109264 Fri, 10 Apr 2020 06:11:21 +0000 https://www.codexworld.com/?p=3449#comment-109264 In reply to Francesco.

This tutorial will help you – https://www.codexworld.com/send-email-with-multiple-attachments-php/

]]>
By: Francesco https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-109086 Wed, 08 Apr 2020 15:53:21 +0000 https://www.codexworld.com/?p=3449#comment-109086 Excellent script.
But to send more than one attachment, how can you modify it?
Thanks

]]>
By: Maria José https://www.codexworld.com/php-contact-form-send-email-with-attachment-on-submit/comment-page-1/#comment-107140 Wed, 11 Mar 2020 05:16:30 +0000 https://www.codexworld.com/?p=3449#comment-107140 form works but how can i have it upload more than one file at a time?

]]>