2

In my ColdFusion application, I want to keep the images outside of wwwroot in this folder: C:\extSite\stdImages

I created a mapping in wwwroot\WEB-INF\jrun-web.xml like this:

<virtual-mapping>
    <resource-path>/extStdImages</resource-path>
    <system-path>C:\extSite\stdImages\</system-path>
</virtual-mapping>

To display an image, I do this:

<img src="/extStdImages/abc.jpg">

This works fine on my dev site (which is using ColdFusion's built-in web server), but the image does not display in production (where I am using IIS). I am wondering if I have to tweak something in IIS or elsewhere on the production server to allow access to these files.

Can anyone help? Thanks in advance!

Peter

3 Answers3

4

In iis you would need to create a virtual dir that points to the images folder. Although putting images outside the wwwroot is pointless as they must be web accessible in order for them to display on a web page. The only reason to do this would be.if you were protecting copyright images with passwords and not linking to them directly.

snake
  • 732
  • 1
  • 6
  • 11
3

If your on IIS, you may want to look at this for your web.config

http://www.iis.net/configreference/system.applicationhost/sites/site/application/virtualdirectory

here is a sample:

<site name="Contoso" id="2" serverAutoStart="true">
   <application path="/">
      <virtualDirectory path="/" physicalPath="C:\Contoso\Content" />
   </application>
   <application path="/CRM">
      <virtualDirectory path="/" physicalPath="C:\Contoso\Content\CRM" />
      <virtualDirectory path="/Images" physicalPath="E:\Images" />
   </application>
   <bindings>
      <binding protocol="http" bindingInformation="*:80:www.contoso.com" />
   </bindings>
</site>
steve
  • 1,490
  • 10
  • 18
0

This is wrong C:\extSite\stdImages\ You have to use slashes not backslashes for CF This is correct and works C:/extSite/stdImages/