검색 방법을 만들어 내 아웃 바운드 전자 메일에 파일을 첨부하려고합니다. 폴더 안에서 검색하고 특정 문자로 시작하여 전자 메일에 첨부하는 모든 파일을 찾아야합니다. 난 단지 당신이 그러한 검색 방법을 만들 수있는 방법에 대한 머리를 시작해야합니다 그래서 어떤 포인터 또는 참조 링크를 높이 평가됩니다. 검색 ColdFusion 9의 폴더
이
내가 지금까지 가지고 있지만 내가 대신GetBaseTemplatePath()
<cfscript>
attributes.attachments = 2011093475839213;
</cfscript>
<cfset Directory = "E:\sites\Example.com\FileFolder\#attributes.attachments#">
<cfset CurrentDirectory=Directory>
<cfset CurrentDirectory=ListDeleteAt(CurrentDirectory,ListLen(CurrentDirectory,"/\"),"/\")>
<cfoutput>
<b>Current Directory:</b> #CurrentDirectory#
<br />
</cfoutput>
<cfdirectory action="list" directory="#CurrentDirectory#" name="result">
<cfdump var="#result#">
의 경로를 사용할 때 내가
<cfset CurrentDirectory=GetBaseTemplatePath()>
내 코드에 의해 약간의 코드를 변경하는 경우가 올바른 작동하지 않는 것 무엇입니까 작품과 나는 현재 디렉토리에있는 모든 파일의 목록을 얻을. 내가 볼 수없는 내 길에서 실수가 있습니까?
이것은 내 CFMAIL 부분이며 문제가 있습니다. #result#
쿼리를 덤프하면 폴더 안에 모든 파일이 있습니다. 그러면이 오류가 발생합니다 :
The resource 2011093475839213.pdf was not found.
The root cause was: ''.
첨부 파일이 아닌 오류에도 불구하고 이메일을 수신합니다.
<!--- Email Test --->
<CFMAIL FROM="[email protected]" TO="[email protected]" SUBJECT="Test" type="HTML">
<P> This is the attachment test</P>
<p> For this test to be successful, we need to receive some file attachments with this email</p>
<cfloop query="result">
<cfmailparam file="#result.name#" disposition="attachment">
</cfloop>
</cfmail>
<!--- Email Test Ends --->
어떤 일이 당신은'<하는 cfdump VAR = # DirectoryExists (은 CurrentDirectory) # />'한다면? 또한 'ListDeleteAt' 물건이 필요 없습니다 - ['getDirectoryFromPath'] (http://cfdocs.org/getdirectoryfrompath) –
나는 DirectoryExists로 그걸 돌아 다니며 내 경로에 오류가있었습니다 아무튼. 관련된 하위 디렉토리가있을 때 몇 가지 문제가 있기 때문에 getDirectoryFromPath를 사용하려고합니다. – Geo
'cfmailparam' 태그에'Resource 2011093475839213.pdf '오류가 표시됩니다. 근본 원인이었다 : 나는 쿼리를 덤핑하고 을 .' ''해당 파일이 존재한다. 왜 저에게 오류가 발생하는지 모르겠습니다. – Geo