Solved

Read Only CSV file?

Posted on 2013-01-08
6
715 Views
Last Modified: 2013-01-08
I am using the QueryToCSV solution documented in Ben Nadel's blog below to generate a CSV file in CF9. I have a requirement to generate a read-only file. Is there a relative easy way to add a read-only attribute to a CSV file?

http://www.bennadel.com/blog/1239-Updated-Converting-A-ColdFusion-Query-To-CSV-Using-QueryToCSV-.htm

Thanks
0
Comment
Question by:Jerry Miller
  • 4
  • 2
6 Comments
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 500 total points
ID: 38756567
If you're saving it on the server, you can use

       FileSetAttribute("c:\path\to\yourFile.csv", "readOnly")

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-6d00.html
0
 
LVL 18

Author Comment

by:Jerry Miller
ID: 38756651
I am trying to avoid saving files on the server. That is why I need to set the attribute on creation if possible.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38756791
Hm.. are you talking about a file download? If so, afaik you can't do that.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 38756833
The comments in this thread supports the "not possible with file downloads" theory. (CF is basically a java servlet, so the same rules apply: )

You can't do that. The client does what he wants with the stream of bytes that the servlet sends. He can choose to cancel save it as a file, to ignore it, to save it with another name, anything. You won't gain access to the client machine from the server.

In other words, there's no way you can force a file download to be read-only.
0
 
LVL 18

Author Comment

by:Jerry Miller
ID: 38756869
I was afraid of that. I haven't yet been told that it is a requirement, but I am anticipating the questions once they see the 'save as box'.

Thanks for the help.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38756881
Glad I could help ...  though sorry I didn't have better news :/ Unfortunately once you serve up a file for downloading it's pretty much out of your control.  Users can do whatever they want with it.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question