Solved

absolute url server path for image

Posted on 2003-11-10
5
525 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now