Solved

Read Only CSV file?

Posted on 2013-01-08
6
709 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now