I am trying to get a file from an automatic download URL using cfhttp. I am using the following code:
<cfhttp method="get" url="http://www.example.com/getfile" path="E:/" file="abc.csv">
In this case, I specified the file type as CSV, so I can get the file, but the file type can change. I tried CFHTTP.MIMETYPEto get the file type and use like this:
<cfhttp method="get" url="http://www.example.com/getfile">
<cffile action="write" file="E:/abc.#listLast(cfhttp.MIMETYPE,'/')#" output="#cfhttp.FileContent#">
And this works for CSV and XML files. But I want it to work with Excel files too.
Please, help. Thanks in advance.
source
share