Solved

absolute url server path for image

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
What You Need to Know when Searching for a Webhost Provider
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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