Solved

Can I upload an Image from a URL using <cffile?

Posted on 2011-02-15
3
444 Views
Last Modified: 2012-05-11
Hello,

I would like to upload an image to my server from a URL using <cffile or any other means.  In other words, in the filefield, I was trying to put in a url like 'www.example.com/images/testimage.jpg'

However, I'm receiving an error 'The form field testImage did not contain a file' ..

What I'm doing is injecting the URL into a hidden form field and then submitting that form to <cffile.

Any ideas??

Thanks!!!!!!!
0
Comment
Question by:stracqan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 34903889
Cffile can only manipulate files accessible on the local server. To grab an image from a remote url use CFHTTP or one of the image functions/tags. Both ImageNew() and CFIMAGE can read a url image. Then you can save the image object locally.  Assuming you have permission to use the image of course.



0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 34903894
CFHTTP
http://stackoverflow.com/questions/1536815/convert-an-image-from-cfhttp-filecontent-to-binary-data-with-coldfusion/1537433#1537433

IMAGENEW/CFIMAGE
http://livedocs.adobe.com/coldfusion/8/functions_h-im_34.html
<!--- This example shows how to create a ColdFusion image from a URL. --->
<cfset myImage = ImageNew("http://www.google.com/images/logo_sm.gif")>
<cfset ImageWrite(myImage,"google_via_imagenew.png")>
0
 

Author Closing Comment

by:stracqan
ID: 34903922
As always _agx_, thank you!!!!! ..

(PS The URL is coming from an online Image Editor that sends a responce back to my site via a URL and in their terms of service they grant permission to acess the file in order to save locally.  Thanks for making sure I'm doing something cosher!!)
0

Featured Post

Containers and Docker for Everyone

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question