how to get the file in another pc using coldfusion, im having trouble in getting data as attachment from another pc, heres the scenario:
in my cfmail i need to get file from another pc to be attached on my mail.i need to get the file automatically . i am using cfdirectory to get the file but its not working if the file is outside the server, can somebody has a solution to this?
here is my code:
<cfif IsDefined("form.mail")>
<cfif form.mailto is not "">
<cfmail to = "#form.mailto#"
CC="t"
from = "#form.mailfrom#"
subject = "#form.subject#">
#form.message#
<cfmailparam file="D:/CURRENT TASK/cache/#form.attachmen
t#">
</cfmail>
<h3>Thank you</h3>
Your message has been sent to <em style="color: #990000;"><cfoutput>#form.
mailto#</c
foutput></
em>.
</cfif>
<cfelse>
<cfset CurrentPage=GetFileFromPat
h(GetTempl
atePath())
>
<cfdirectory directory="D:/CURRENT TASK//cache" name="dirQuery" action="list">
<form action="#CurrentPage#" name="theForm" method="post">
<!---Get all directory information in a query of queries.--->
<cfquery name="dirsOnly" dbtype="query">
SELECT name FROM dirQuery
order by dateLastModified desc
</cfquery>
<cfdump var="#dirsOnly#">
<cfoutput>#dirsOnly.name#<
/cfoutput>
<table width="598" height="180" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="16%" class="columnheader"> 
;<strong>T
o :</strong></td>
<td width="84%" class="listdetail"><input type = "Text" name = "mailto" class="input" value="<cfif isdefined("url.email")><cf
output>#ur
l.email#</
cfoutput><
cfelse><cf
output>#fo
rm.mailto#
</cfoutput
></cfif>" onKeyPress="return isValidEmailInput(event);"
></td>
</tr>
<tr>
<td class="columnheader"> 
;<strong>F
rom :</strong></td>
<td class="listdetail"><input type = "Text" name = "mailfrom" class="input" value="<cfif isdefined("url.sender")><c
foutput>#u
rl.sender#
</cfoutput
><cfelse><
cfoutput>#
form.mailf
rom#</cfou
tput></cfi
f>" onKeyPress="return isValidEmailInput(event);"
></td>
</tr>
<tr>
<td width="16%" class="columnheader"> 
;<strong>A
ttachment:
</strong><
/td>
<td class="listdetail"><img src="../images/pdf-file.gi
f" width="22" height="22">PDF file
<input type="text" name="attachment" class="input" value="<cfoutput>#dirsOnly
.name#</cf
output>" > </td>
</tr>
<tr>
<td class="columnheader"> 
;<strong>S
ubject :</strong></td>
<td class="listdetail">Quotati
on<input type="hidden" name="subject" class="input" value="Quotation"></td>
</tr>
<tr>
<td valign="top" class="columnheader"> 
;<strong>M
essage :</strong></td>
<td class="listdetail"><textar
ea name="message" cols="60" rows="6" class="input"></textarea><
/td>
</tr>
Start Free Trial