We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
_____________FINAL FIX
avalancha = magepsycho (Check CAP leters Magento very sketchy)
IndexController.php replace this line with (or add /)
$fileName = preg_replace('/\s+/', '', $fileNamewoe) . time() . '.' . $fileExt;
\app\code\local\Avalancha\Customcontact\etc\config.xml
<config>
<modules>
<avalancha_customcontact>
<version>1.0.0</version>
</avalancha_customcontact>
</modules>
<frontend>
<routers>
<contacts>
<args>
<modules>
<customcontact before="Mage_Contacts">Avalancha_Customcontact</customcontact>
</modules>
</args>
</contacts>
</routers>
</frontend>
</config>
\app\etc\modules\Avalancha_Customcontact.xml
<config>
<modules>
<avalancha_customcontact>
<active>true</active>
<codepool>local</codepool>
</avalancha_customcontact>
</modules>
</config>
you can thks me or like in my instagram/twitter @mc_bosc its free
thanks for these methods however if they need help here is one file hosting - http://anonyfile.space
I've worked for hours on this and though the email comes through there is no attachment. Tried all the suggestions in this thread and other threads by individuals with similar problems adding attachments to the contact form. Baffling how some people here get it to work. It would be helpful if someone who this actually works for would clue all of us in on the details that these instuctions leave out.
Unfortunately the link below from "Prash" doesn't work anymore either, I'd gladly embrace an alternative solution. Suprising that for a platform as popular as Magento that the simple enabling of the contact form with an attachment functionality seems to be such a frustrating endeavour for a large percentage of the people trying to accomplish it.
Hi,
I did this and able to bring Attachment button. But there are no attachments with the email. Can anyone tell how to rectify this
Regards
Sagar
Do I replace the entire block of code inside config.xml currently? -
<frontend>
<routers>
<contacts>
<use>standard</use>
<args>
<module>Mage_Contacts</module>
<frontname>contacts</frontname>
</args>
</contacts>
</routers>
<translate>
<modules>
<mage_contacts>
<files>
<default>Mage_Contacts.csv</default>
</files>
</mage_contacts>
</modules>
</translate>
<layout>
<updates>
<contact>
<file>contacts.xml</file>
</contact>
</updates>
</layout>
</frontend>
Thanks for this great post, its working for me, i want to upload multiple image, please help me.
Thanks
it work! Magento 1.9, just copy the contact module to another new and add the code for attach a file and work!
Thanks men, +10
Did you place the Contacts form into a CMS page?
How about adding Magento's core CAPTCHA into the form after the file attachment field?
Please share what and how you did to get it to work. I'm using Magento 1.9.2.1.
Thank you.
You had done great job for us. But i want some advance features regarding Products Attachments. Thats why i was compell to install an updated Extension. If any one needed that Module they can get it from this URL link:http://www.fmeextensions.co...
i added extra field in contact form that is attachment field i follow the above steps but still am getting error "unable to submit try again later".. plz help me
can you tell where this contact form data is stored in magento
Thnx for you post. It is working perfect.
i thing you miss one thing .
create xml file MagePsycho_Customcontact.xml in app/etc/modules/MagePsycho_Customcontact.xml
<config>
<modules>
<magepsycho_customcontact>
<active>true</active>
<codepool>local</codepool>
</magepsycho_customcontact>
</modules>
</config>
Thx for your great post!!
First, I think you've got a typing mistake in your IndexController on line 3.
Then, what about the error messages, if for example, the file extension is wrong?
greetings
I think I'm having problems coding the config.xml (Namespace: Newform / Module name: Customcontacts). I have this so far but I don't know if it is correct:
0.0.1
Newform_Customcontacts
Does someano know if this xml file has an error?
Thanls for your time.
i am uploading pdf file "AIO Printer.pdf" while file uploaded to corresponding folder in filename space is replaced by "_" so in server file exists with AIO_printer.pdf but at this line
$attachmentFilePath = Mage::getBaseDir('media'). DS . 'contacts' . DS . $fileName;
if(file_exists($attachmentFilePath))
{
}
it shows file does not exists & redirects me to else portion
Everything seems to work fine, except the IndexController.php
For whatever reason, it is unable to attach the image to email, and it's not even adding the image into the media/contacts directory either.
Can you provide a solution?
One bug that I found in the php code is found in line 41:
$fileName = preg_replace('/\s+', '', $fileNamewoe) . time() . '.' . $fileExt;
The missing part is the delimiter ' / ', so the code would be like this:
$fileName = preg_replace('/\s+/', '', $fileNamewoe) . time() . '.' . $fileExt;
The problem that i encoutered coding this extension is that mi config.xml is having trouble finding the code, module, etc. to override, so I decided to paste part of the php code (the part of finding and uploading the attachment) in the app/code/core/Mage/contacts/IndexController.php in order to avoid overriding. So far the document is uploaded to the server but the part that is not working is sending the email with the attachment.
You also have to consider modifying line 44 for accepting image extensions:
$uploader->setAllowedExtensions(array('doc', 'docx','pdf'))
As you can see, the code is currently just accepting Microsoft Word and pdf files.
Please simplify the second steps, we didn't get any effect of this code......
I did this tutorial 3 times and still the same result. The email form is fine (the upload buttons are there), but no images are attaching to the email. Please help!!!
hello:
modify
form.html
app/code/core/Mage/Contacts/etc/config.xml
add
app/code/local/MagePsycho/Customcontact/controllers/IndexController.php
context menu
Contatti
error:
Whoops, our bad...
??
TKS
I'm not sure what i'm doing wrong. I have done what you say but it didn't work. Maybe the first step have to be in an specific place? (the form I mean).
1. Modify the contact form template
You need to modify the contact form template file: app/design/frontend/[your-interface]/[your-theme]/template/contacts/form.phtml:
a> Add enctype=”multipart/form-data” in element as:
Thank you and best regards,
Hi!
This works for me:
Replace:
$attachmentFilePath = Mage::getBaseDir('media'). DS . 'contacts' . DS . $fileName;
if(file_exists($attachmentFilePath)){
$fileContents = file_get_contents($attachmentFilePath);
$attachment = $mailTemplate->getMail()->createAttachment($fileContents);
$attachment->filename = $fileName;
}
for:
$attachmentFilePath = Mage::getBaseDir('media'). DS . 'contacts' . DS . $fileName;
if(file_exists($attachmentFilePath)){
$fileContents = file_get_contents($attachmentFilePath);
$mailTemplate->getMail()->createAttachment($fileContents,
Zend_Mime::TYPE_OCTETSTREAM,
Zend_Mime::DISPOSITION_ATTACHMENT,
Zend_Mime::ENCODING_BASE64,
$fileName);
}
This is not working.. Try this.. works perfect ! http://www.magentocommerce....