Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uploading files to server

Status
Not open for further replies.

Benbunny

Programmer
Mar 19, 2001
18
0
0
HK
Hello all, can anyone help me to solve a uploading problem. I would like to ask user to insert the gif or jpg file from the browser. After that the file will upload into the defaulted directory of Linux server.

Coding:
<cffile action=&quot;upload&quot;
filefield=&quot;uploadfile&quot;
destination=&quot;//home&quot;
nameconflict=&quot;Error&quot;>


Error message:
-----------------------------------------------------------
Error processing CFFILE

The directory specified in the DESTINATION attribute of the CFFILE tag (//home/) is not valid. The directory either does not exist or is not accessible by the ColdFusion service.

The error occurred while processing an element with a general identifier of (CFFILE), occupying document position (8:1) to (11:22).
-----------------------------------------------------------

Actually, I have tried different path name. But it still not work.
Thanks all of your kindly help!

 
Hi benbunny,

For an upload to work, you must use the full path.
You can obtain that path by using the following:

Code:
<cfset uploaddir = GetDirectoryFromPath(ExpandPath(&quot;../home/&quot;))>
(guess you have to play a bit with this, to get it to your liking :) )

Then you use the following:

Code:
<cffile action=&quot;upload&quot;
 filefield=&quot;uploadfile&quot;
 destination=&quot;#uploaddir#&quot;
 nameconflict=&quot;Error&quot;>

Hope this solves your problem? :p

(I don't know CF on Unix, but I guess this works in the same way)

Gtz,

Kristof -------------------
Check out my new site:

Any suggestions are more than welcome.
There's a LOT of work to do, so judge fairly. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top