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

Opening Files

Status
Not open for further replies.

danarashad

Programmer
Nov 2, 2006
115
US
Is there a way I could use coldfusion so users could open up a file in an external program. Then have make changes and save it back to the server.
 
First part: easy. Use CFCONTENT and the MIME type.

Second part: hard to impossible. The downloaded file is a copy of the original, and because of security considerations the application can NOT save it back to the Web server directly. They would have to save locally, then use some sort of upload tool. If you're in an Intranet, it may be possible if you give users access to the document share. Externally, though, no way without an upload step.

There's a good reason why document collaboration systems are so expensive ;^)

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Not NULL-terminated yet.
 
Works for text files. What about spreadsheets, documents, etc.?
 
Yes I am actually opening a style sheet. All you have to do is, change the javascript to add a file extension.
<cfscript>
variables.validFile = 1;
if (NOT reFindNoCase('.css$|.htm$|.html$|.cfm$|.cfml$', URL.file))
{
variables.validFile = 0;
}
</cfscript>
Or if you want to target one file like I do. change this javascript. to match what file you want.
<cfscript>
if (NOT structKeyExists(form, 'fileExt')) form.fileExt = "style.css";
</cfscript>
 
So long as your file is ASCII and can be edited in a textarea. This doesn't work for binary format files.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Not NULL-terminated yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top