Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

absolute url server path for image

Posted on 2003-11-10
5
Medium Priority
?
605 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
[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
5 Comments
 
LVL 6

Accepted Solution

by:
PE_CF_DEV earned 1200 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 300 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

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

604 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