Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Read Only CSV file?

Posted on 2013-01-08
6
Medium Priority
?
743 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 2000 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
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 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

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

722 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