By default the file is writable, set to readonly.. if you require so.. wouldnt this work?

filePath = "C:\\Inetpub\wwwroot\mytest.txt";

jFile = createObject("Java","java.io.File");
jFile.init(filePath);
jFile.setReadOnly();// only if you require it to be ready only

Or

You can use FilePermisssion

jFileSecurity = createObject("Java","java.io.FilePermission");
jFileSecurity.init(jFile, "write");

Joe
  ----- Original Message -----
  From: Kyle McNamara
  To: CF-Talk
  Sent: Tuesday, November 18, 2003 11:02 AM
  Subject: java in CFMX question

  I am doing this now before any time they try to open the file:
  <cfobject type="JAVA" name="jFile" class="java.io.File" action=""
  <cfscript>
  newAttribute = jFile.init('filenameher');
  newAttribute.setReadOnly();
  </cfscript>

  ...which seems to be working well.

  The only thing is, ther are certain times I need to make it writeable too... when researcfing the FILE class at <http://java.sun.com/j2se/1.4.2/docs/api/index.html> I noticed that they have setReadOnly(); and but no way to set it to writeable... it has a function to check if it is currently wriateable (canWrite();).... but nothing else I can see...

  any thoughts on this?

  tia,
  k

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to