?
Solved

absolute url server path for image

Posted on 2003-11-10
5
Medium Priority
?
591 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 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