File(s) Upload attachment not showing in email

Permalink Browser Info Environment
I am using Formidable 2.1.3 to create our forms. We want job applicants to be able to upload their resumes for review. When I test the File(s) Upload element in the form everything seems to work okay except the emailed attachment. The uploaded file is entered with the correct name and size but it is not an active link to the file, it comes in as just text. How can I fix this?

Type: Discussion
Status: In Progress
kesslerdesign
View Replies:
DeWebmakers replied on at Permalink Reply
DeWebmakers
Hi,

Files uploaded can be added as attachments in the mail, but not as links in the message itself.

Best,

Corretje
kesslerdesign replied on at Permalink Reply
kesslerdesign
Let me be a little more clear. When, for example, I attach a pdf titled "resume.pdf" to the form to be sent with the email, when the recipient receives the email they cannot download the pdf because at that point it isn’t an attachment - it is just reads as text with the name "resume.pdf". I need to know how to make sure the resume file itself comes through as an attachment.
unionsystems replied on at Permalink Reply
unionsystems
Hi Kesslerdesign,

I think I am experiencing the same issue. The attached file does get added to the File Manager and you can download it from there. But it would be nice if the email that comes from the submission of the form had a hyperlink to the source of the file rather than just the name of the file.

Dewebmakers, which PHP file would we need to amend in your package to make the name of the file include a hyperlink to the actual file?

Thanks
insyntrix replied on at Permalink Reply
insyntrix
I'm having the same issue, i have 5 forms which all include a file upload field and each one has its own file set where the files get uploaded to. I have the check box checked in the Attachments section in the Emails area to attached the uploaded file to the emails, but only one file set is available to choose from when there should be 5.

And like Kesslerdesign says it only shows the file name but no attachment in the email. As an admin I can go the file set and download the attachments but the person who is receiving the submissions will not have access to the site in order to download the attachments.
DeWebmakers replied on at Permalink Reply
DeWebmakers
Hi,

Sorry for the late reply. Been on holiday and after returning I was very busy on several projects...

Can you check if the mail you are getting is in HTML?

There is a model in the models/formidable/element/fileupload.php directory.
In that file there should be a method "result" there is the function that will generate the result in the mailing. I thought is was a link already, but I guess I'm wrong...

Best,

Corretje
insyntrix replied on at Permalink Reply
insyntrix
Thanks for the reply, its seems that you have the correct code for the link.

I'm noticing that some attachments are coming through while others are not through the same form. I just received a submission the other day and the image was included as an attachment?
web089 replied on at Permalink Reply
web089
Hi Corretje,
I have the same issue.
The attachment will shown in the backend area but not as an real attachment in the email of the recipient. In that case the recipient has no access to the file manager (backend) so that would really helping to send the attachment directly by email.
DeWebmakers replied on at Permalink Reply
DeWebmakers
You need to add the attachment manually to the mail.
Check de attachment tab in the mailconfiguration.

Why some attachement aren't being send is a mystery. Maybe your spamfilter is blocking the file. Not sure what is going on. I've run some tests with some files and it seems to work on my end. Another issue could be the size of the attachments or the total of the attachments.

Best,

Corretje
web089 replied on at Permalink Reply 1 Attachment
web089
I get all information in the C5 backend (results) - attachment(s) included.
In the email which the recipient will get you see only the attachments-name an the flie-size, but it is not clickable or /and not attached.

btw. depends not on spam or file size or something like that.
I`m really helpless.
DeWebmakers replied on at Permalink Reply
DeWebmakers
Hi,

2 things...

1. If you want the file to be an attachment (seperate in the mail) you need to add this to the mail configuration. The file wil be send with the mail.

2. A link, as you would like, is created by the addon.

To solve your problem (link in mail).... please check if your recipient allows HTML mails. If not the link is removed and you only see the text. You can check this by checking the mime-type of the mail. It cna be found in the header of the mail.

Best,

Corretje
web089 replied on at Permalink Reply
web089
"1. If you want the file to be an attachment (seperate in the mail) you need to add this to the mail configuration. The file wil be send with the mail."

May be it is a misunderstanding. The customer don`t want to send an attachment. The sender has to send an attachment by using the form to my customer.

"2. A link, as you would like, is created by the addon."
Sorry, but it doesn*t work yet.

"To solve your problem (link in mail).... please check if your recipient allows HTML mails. If not the link is removed and you only see the text. You can check this by checking the mime-type of the mail. It cna be found in the header of the mail."

I tried this with several emal-clients (Outlook, thunderbird, ...) - html works.
DeWebmakers replied on at Permalink Reply
DeWebmakers
So you do want to send an attachment with the mail. From the submitter to the recipient ( your customer). You need to add this in the mailconfiguration.

Why the attachment is not a link in the message is a weird issue. It should be there.
Can you add a link in your message manually. See if the link preserves when a mail is send.

Best,

Corretje
web089 replied on at Permalink Reply 2 Attachments
web089
"So you do want to send an attachment with the mail. From the submitter to the recipient ( your customer). You need to add this in the mailconfiguration."

No, no, no - I`m the webdesigner and I do this for my customer. I know what you mean, but this is not the issue (see attachment - I don`t need this).

"Why the attachment is not a link in the message is a weird issue. It should be there.
Can you add a link in your message manually. See if the link preserves when a mail is send."

Done. The link works as it is manually integrated.

But the problem is not solved, sorry. See both attachments!
web089 replied on at Permalink Reply
web089
The problem is not solved.
DeWebmakers replied on at Permalink Reply
DeWebmakers
Hi,

I've been looking in to this.... Please try the following.
Find the file /packages/formidable/models/element/fileupload.php
Find the following code:
public function result($value = array(), $seperator = ', ')
   {         
      $ih = Loader::helper('image');
      $_value = $this->value;
      if (!empty($value))
         $_value = $value['value'];
      if (!empty($_value)) {
         foreach ((array)$_value as $file) {
            if (intval($file['file_id']) != 0) {
               $f = File::getByID($file['file_id']);
               if (is_object($f)) {
                  if (in_array($file['ext'], $this->preview_extensions))
                     $files[] = '<div class="upload_preview" data_fID="'.$f->getFileID().'">
                                 <a href="javascript:;">'.$ih->outputThumbnail($f, 50, 50, $file['name'], true).'</a>
                                 <a href="'.$f->getForceDownloadURL().'">'.$file['name'].'</a> ('.$this->convert_size($file['size']).')

and change this to:
public function result($value = array(), $seperator = ', ')
   {         
      $ih = Loader::helper('image');
      $_value = $this->value;
      if (!empty($value))
         $_value = $value['value'];
      if (!empty($_value)) {
         foreach ((array)$_value as $file) {
            //if (intval($file['file_id']) != 0) {
               $f = File::getByID($file['file_id']);
               if (is_object($f)) {
                  if (in_array($file['ext'], $this->preview_extensions))
                     $files[] = '<div class="upload_preview" data_fID="'.$f->getFileID().'">
                                 <a href="javascript:;">'.$ih->outputThumbnail($f, 50, 50, $file['name'], true).'</a>
                                 <a href="'.$f->getForceDownloadURL().'">'.$file['name'].'</a> ('.$this->convert_size($file['size']).')

Then save and try again.

Best,

Corretje
web089 replied on at Permalink Reply 1 Attachment
web089
Thank you for the code ( // ).
The link of the attachment will shown (see attached screenshot), but the target does not show the real file and is not linking to file: http://domain-name.com/index.php/download_file/force/0/...
DeWebmakers replied on at Permalink Reply
DeWebmakers
Then there is only one option left...

The file isn't uploaded or uploaded correctly. The results method you just changed, checks if a file is a real object in the filemanager. Try it with different file sizes and file types. See if there is some change.

Best,

Corretje
kesslerdesign replied on at Permalink Reply
kesslerdesign
Hello all,
These changes were give to us by and seemed to fix the problem. Changes to the /packages/formidable/models/formidable/mailing.php around line 310


// Set Message
$_message = $this->prepareMessage();

$mh->setBodyHTML($_message);
$mh->setBody($th->sanitize($_message));

// Set attachments
$_attachments = array();
if (!empty($this->attachments))
$_attachments += $this->attachments;

$files_to_mail = $this->files_to_mail;
if ($this->attachments_element == 1 && !empty($files_to_mail)){
/* changed by Hutman 08/07/15 */
/*
foreach ((array)$this->attachments_element_value as $_element)
foreach ((array)$files_to_mail[$_element] as $_file)
$_attachments[] = $_file['file_id'];
*/
foreach ((array)$files_to_mail as $_key => $_files){
if(count($_files) > 0){
foreach($_files as $_file){
$_attachments[] = $_file['file_id'];
}
}
}
}

if (sizeof($_attachments) > 0) {
foreach ($_attachments as $_attachment) {
if (empty($_attachment))
continue;

$f = File::getByID(intval($_attachment));
if (intval($f->getFileID()) != 0) {
$fv = $f->getApprovedVersion();
$mh->addAttachment($fv->getPath(), $fv->getFileName(), $fv->getMimeType());
}
}
}

// Send the mail!
$mh->sendMail(true);
$mh->reset();

return true;
}



Best,
kesslerdesign
web089 replied on at Permalink Reply
web089
HI Kessler,
thx for your help. I changed the code but the result is still the same (force/0)
http://domain-name.com/index.php/download_file/force/0/...

G.
web089 replied on at Permalink Reply
web089
I tried it with different file types - but the same result happened.
DeWebmakers replied on at Permalink Reply
DeWebmakers
If the ID of the file is 0 the file can't be found or isn't there. You need to check the filemanager to see if the file is uploaded... Is it in the filemanager?
web089 replied on at Permalink Reply
web089
Yes, the file is shown in the filemanager.

concrete5 Environment Information

# concrete5 Version
5.6.3.3

# concrete5 Packages
Advanced Slider (2.0.1), Back To Top (1.0.0), Content Slider (1.2.5), Designer Content (3.1.1), Easy Accordion (1.1.2), Easy tabs (1.7.2), Formidable (2.1.3), Formigo Slider (1.0.4), Google Map (Premium) (2.1), Job Board (1.07), RonyD Icons (0.9.2), Silence Theme (1.7.3), Ticker (1.0.1), tnSpacer (1.3).

# concrete5 Overrides
blocks/top_border, languages/sl_SI, languages/tr_TR, languages/ru_RU, languages/es_PE, languages/zh_TW, languages/nb_NO, languages/es_ES, languages/fi_FI, languages/es_MX, languages/pt_PT, languages/nl_NL, languages/el_GR, languages/fa_IR, languages/de_DE, languages/es_AR, languages/cs_CZ, languages/sk_SK, languages/it_IT, languages/ro_RO, languages/ar, languages/vi_VN, languages/fr_FR, languages/da_DK, languages/ja_JP, languages/sv_SE

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - Off

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.2.17

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, ctype, curl, date, dba, dbase, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, ionCube Loader, json, ldap, libxml, mbstring, mcrypt, mhash, mime_magic, mysql, mysqli, odbc, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, Reflection, session, SimpleXML, soap, sockets, SPL, SQLite, standard, tokenizer, xml, xmlreader, xmlwriter, xsl, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
memory_limit - 256M
post_max_size - 8M
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - On
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 2M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 100000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:39.0) Gecko/20100101 Firefox/39.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.