Copy link to clipboard
Copied
I have two intranet sites on two different servers. There is an image on the site1 which I would like to copy to site2. How do I do that ?
Here is my code.
<cfset image1Ext = Right(firstStoryImg, 3)>
where firstStoryImg evaluates to http://mycompany.com/site1/images/firstImage.gif
The following code is throwing "The cause of this exception was: java.io.FileNotFoundException:" error.
<cffile action="copy" source="#firstStoryImg#" destination="/folder/Images/image1.#image1Ext#" nameconflict="overwrite">
Copy link to clipboard
Copied
You can't use <cffile...> to copy an HTTP url. You need to use <cfhttp...> for an HTTP url. With <cffile...> you are expected to use a file system path.
Copy link to clipboard
Copied
What he said.
In addition:
<cfset image1Ext = Right(firstStoryImg, 3)>
What happens if someone uploads a (valid) .jpeg file? You'll land yourself with a .peg file, that's what.
Copy link to clipboard
Copied
Thanks. The following code worked for me.
<cfhttp url="#firstStoryImg#" path="#ExpandPath("\usaNewsImages\")#" resolveurl="No" timeout="120"></cfhttp>