Prior to ColdFusion 4.5 there was no simple way to send multiple e-mail attachments using the <CFMAIL> tag. In CF 4.5 that tags MIMEATTACH attribute still only supports a single attachment, but you can use multiple <CFMAILPARAM> tags to attach multiple attachments. - tleish
If I use form <input type="file" name="attachment"> to browse the files, do I have to have several <input>, for example:
<input type="file" name="attachment1">
<input type="file" name="attachment2">
...
and then use same number of <cfmailparam>?
Is there any way I can use a list with the delimiter ";" to do it as I did for the email list...? (<cfmail to="#ValueList(queryname.email, ";"#"...>) or loop...?
You should be able to code an interface in javascript that lets the user repeat this multiple times: browse for a file, add it to a list (a list kept in a Javascript variable). When the user submits, the list can be appended to the URL of the new page or serialized into a WDDX packet and passed to the new page. I would recommend against using semicolon as a delimiter as it's a valid character in a filename. Use a tab or something. We usually use a chr(6).
The following works in IE 5.5. It does not work in Netscape 4.7 because Netscape is not capturing the event "onChange". If your users use Netscape, you'll have to experiment to find out which events are being captured. Or try Netscape 6.2
Also, there are other ways to get the Javascript data to ColdFusion.
You will probably want to give the user the opportunity to edit the list too. What if they select the wrong file? There is no way for them to remove it from the list, except by refreshing the page and starting over. We have used a TEXTAREA to display the list elements, one per line. The javascript puts the filename selected into the TEXTAREA as they are selected (instead of filespeclist above) and the user can edit the TEXTAREA directly. When processing the TEXTAREA variable, you must remember that the list delimiter will be a newline.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.