Solved

absolute url server path for image

Posted on 2003-11-10
5
549 Views
Last Modified: 2013-12-24
i have the following code

<cfif isdefined("form.picture") and len(form.picture)>
                            <cffile action="UPLOAD" destination="#expandPath('.')#\files\" filefield="form.picture" accept="image/pjpeg" nameconflict="MAKEUNIQUE">
                                                                  <cfif FILE.fileWasSaved>
                                  <cffile action="RENAME" source="#expandPath('.')#\files\#FILE.serverFile#" destination="#expandPath('.')#\files\#SESSION.Auth.UserID#.jpg">
                                    <!---<cfmail to="" from="#session.auth.email" subject="Uploaded Photo">
                                    --->
                                    <cfoutput>
                                    <table width="400">
                                          <tr>
                                                <td style="text-align:justify">The following image was uploaded by #session.user.username# to be used in the Organization Chart and as their managment photo for Carreer Planning</td>
                                                
                                          </tr>
                                          <tr>
                                                <td><img src="absolutepath"><td>
                                          </tr>
                                    </table>
                                    </cfoutput>
                                    <!---
                                    </cfmail>
                                    --->
                              </cfif>

which is on the development server, i would like the image path to be defined by the server so that the path does not need to be hardcoded, this way the same code will work on the development server and the production server

path needs to be: http://server.com/path/to/file.jpg

as the image needs to be part of a third party confirmation email

TIA
0
Comment
Question by:James Rodgers
5 Comments
 
LVL 6

Accepted Solution

by:
PE_CF_DEV earned 400 total points
ID: 9716864
cgi.SERVER_NAME will give the current server name

That should do the trick. If thats not what you were looking for I may not understand your exact need so try to explain further.
0
 
LVL 25

Author Comment

by:James Rodgers
ID: 9717126
that helps but is there another vaiable or method that will give you the current directory in the url format, kind of like GetDirectoryFromPath  but where the output is the server url of the current directory?
0
 
LVL 9

Assisted Solution

by:shooksm
shooksm earned 100 total points
ID: 9717249
CGI.PATH_INFO
0
 
LVL 2

Expert Comment

by:jonnygo55
ID: 9717253
usually I set the path in the application file which are changed from dev server to production

<cfset application.baseWebPath = 'http://server_dev.com/path/to/'> <---on dev

<cfset application.baseWebPath = 'http://server.com/path/to/'>  <--on production

Therefore only need to change that appication variable and it will appropriately apply anywere used....

#application.baseWebPath#file.jpg
0
 
LVL 25

Author Comment

by:James Rodgers
ID: 9717506
thanks to all for their input
with the suggestions provided and with a little work i came up with this

http://#cgi.server_name##mid(getDirectoryfrompath(CGI.PATH_INFO),1,len(getDirectoryfrompath(CGI.PATH_INFO))-1)#

0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php.ini on ipage hosting 12 57
How to switch email hosts (part 2) 11 69
IIS 404 Error on website Automatic Redirect to /help 5 57
app server have enough resources... 2 41
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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