Hi Greg,

The CFCONTENT should be pointing to a drive that is not accessible via the
web.

Here is some of my code:

<cfparam default="" name="attachment">

 <cfif  attachment is not "">

 <cfparam default="application/octet-stream"  name="type">

 <cfif right(attachment,4) is ".txt">
 <cfset type ="text/plain">
 <cfelseif attachment contains ".htm">
 <cfset type ="text/html">
  <cfelseif attachment contains ".html">
 <cfset type ="text/html">
   <cfelseif right(attachment,3) is ".pl">
 <cfset type ="text/html">

  <cfelseif right(attachment,4) is ".doc">
 <cfset type ="application/msword">
  <cfelseif right(attachment,4) is ".xls">
 <cfset type ="application/msexcel">
  <cfelseif right(attachment,4) is ".zip">
 <cfset type ="application/x-zip-compressed">
  <cfelseif right(attachment,4) is ".pdf">
 <cfset type ="application/pdf">
  <cfelseif right(attachment,4) is ".gif">
 <cfset type ="image/gif">
  <cfelseif right(attachment,4) is ".jpg">
 <cfset type ="image/jpeg">
 <cfelseif right(attachment,4) is ".bmp">
 <cfset type ="x-MS-bmp">
 </cfif>


 <Cfif FileExists("#filelocation#")>


 <cfcontent type="#type#" file="e:\imail\users\#session.user#\#attachment#"
>


 <CFELSE>

 <font face="Arial" size="+1"><center>
<b> This file is unable to be accessed. <br>
 The Webmaster has been notified.</b></center></font>

<cfmail to="ali" from="ali" subject="webmail: attachment ">
attachment not accessed
user: #session.user#
pass: #session.pass#
attachment: #attachment#
</cfmail>

</CFif>

Gregory Narain wrote:

> Hi all,
>
> We've got our mail app up and running, finally :)  One of the issues
> that I am having is how to deal with attachments.
>
> We have no problem sorting the attachments into the appropriate place,
> and I think this is more a general CF question, but it's very relevant
> to this group.
>
> I wanted to use CFCONTENT to serve up the user's files to them.  I am
> a bit unsure about specifying the mime type to be used, however.  Sure
> word is .doc, Excel is .xls, but is there a generic way of referring
> to things and having CFCONTENT still deliver the file appropriately?
>
> The real issue with this is that we don't want to put the files into
> any place that is visible from the outside world.
>
> Does anyone have any experience with this?
>
> Thanks,
> Greg
>
> ========================================================================
>      This list server is Power by iMS
>   'The Swiss Army Knife of Mail Servers'
>    -------------------------------------
> To leave this list please complete the form at
> http://www.CoolFusion.com/iMS.htm
>
> List archives: http://www.mail-archive.com/infusion-email%40eoscape.com/
> ========================================================================


========================================================================
     This list server is Power by iMS
  'The Swiss Army Knife of Mail Servers'
   -------------------------------------
To leave this list please complete the form at 
http://www.CoolFusion.com/iMS.htm

List archives: http://www.mail-archive.com/infusion-email%40eoscape.com/
========================================================================

Reply via email to