PDA

View Full Version : Server File Paths with CFFILE



asj
September 20th, 2003, 08:10 PM
With Cold Fusion, in order to upload files like pictures to a server with the CFFILE tag, you have to have the absolute file path on the server (ie. C:\cfusionmx\wwwroot\blah\blah\blah\images\picture .jpg)

Is there anyway to find this file path out? I've come across it once a long time ago by luck inside of an error message, but can't find it again.

This is an example of the tag incase it helps anyone answer the question:
<cffile action="UPLOAD" filefield="file_path" destination="C:\cfusionmx\wwwroot\blah\blah\blah\images\picture .jpg" nameconflict="MAKEUNIQUE">

Please help if you can!.

Thanks

Aaron

awligon
September 20th, 2003, 11:08 PM
I would imagine this could be any folder if you have write access on the server. Just make a dir. ie.. it could be like


/httpdocs/images/picture.jpg

however, it sounds like you're working on a local machine w/ coldfusion installed so it would be whatever your local file path is. I'm not sure what exactly you're asking.

asj
September 20th, 2003, 11:55 PM
I am working off of host, not a local machine. I have continued my research, and everywhere that I have read says that you have to get the path from your host.

What I was asking, was is there any other way to determine the exact file path of the host.

It can't be like '../something.com/pages/images/oahda.jpg'

It has to be more like:
'E:\coldfusion\wwwroot\something\something\somethi ng.com\pages\images\ahda.jpg'

And I don't know how, if there even is a way, to get that file "exact" path.

awligon
September 21st, 2003, 01:11 AM
what about
http://www.yourserver.com/httpdocs/images.blah.jpg

Digitalosophy
September 21st, 2003, 06:28 PM
awligon, i ran into this problem with ASP file uploads.

I think you need to specifiy what drive your web folder is actually in on your webserver

for example

D:\inetpub\digitalosophy\

Call your webhosting company and ask them

awligon
September 21st, 2003, 10:19 PM
aha, I've never had to specify the physical drive to upload files. :-\

Digitalosophy
September 22nd, 2003, 12:23 AM
really? let me show you what i had to do



<%
' Check where the user wants to save the file
If Uploader.Form("saveto") = "disk" Then

' Save the file
File.SaveToDisk "D:\inetpub\wwwroot\iop\files"

ElseIf Uploader.Form("saveto") = "database" Then

blah blah blah
%>



how could you get around that? even in php i had to do that


just curious

asj
September 23rd, 2003, 12:34 AM
I emailed some people around the net and got this answer.

<CFSET MyDir = GetDirectoryFromPath(GetTemplatePath())>
<cfoutput>#myDir#</cfoutput>

It worked , and i figured I would share with everyone else.

Thanks for everyones help.

Aaron