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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write a file to the desktop with cffile...

Status
Not open for further replies.

rjuliano

MIS
Sep 30, 2003
7
US
Hi,

I am trying to figure out what the variable would be for the users desktop. what i am doing is having the users click a submit button and then i want cffile to create the file on their desktop. But users may be using different OS and needs to be under their username (i.e. C:\Documents and Settings\rjuliano\desktop). Is there a way to dynamically call this path. thanks

Rocco Juliano
Heart of Florida United Way
 
You can't do this.

ColdFusion (CFFILE) is not able to write (or even read) files on the clientside machine. For one, the technology isn't correct to allow this (HTTP being a simple request and response protocol, and not a true asynchronous connection between the server and client), and two, it would be a blatant security risk (imagine how many files you'd have on your desktop just from browsing around the web if ColdFusion were able to do this).

In order to get a file to the client machine, the user would have to instigate the transfer (usually by clicking on a hyperlink, or submitting a form) and designating where the file is to be saved. There is no way to force the file to be saved to a particular location short of strongly suggesting in text on the page or javascript message box that it be saved there.

For larger files, you'll want to transfer the file via FTP... but, again, CFFTP probably won't do it for you, as it's serverside, and can't interact directly with the client machine except in the special case of action="upload".

You might be able to use CFCONTENT to get a file to the client machine... but, again, you won't be able to specifically force it to be saved to a particular location... it's at the descretion of the user.


-Carl
 
You may want to check this out:


It's a Java applet I found for doing multiple uploads from a client to the server. I know that it has the ability to also download from the server to the client, though I've never used this feature so I can't vouch for it. It's easy to install and has a ton of options/configurations. It even has CF example pages.

Hope This Helps!

Ecobb
- I hate computers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top