Solved

HTML content-disposition header equivalent in a URL link

Posted on 2013-11-12
3
468 Views
Last Modified: 2013-11-12
is there any way to format a link to click on such that
it will do a SAVE-AS/OPEN  for a CSV file on the server?

i've found Content-Disposition: attachment; filename="<file name.ext>"
but that has to be a part of an HTML file header.   My CSV file is generated and sitting on server disk ready for download.

i suppose i could make a PHP wrapper using that header
and then "playback" the CSV text file to be the HTML page contents.

but is there a more elegant way using a link somehow?
0
Comment
Question by:willsherwood
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
OmniUnlimited earned 500 total points
ID: 39643289
If the CSV is generated and sitting on a web accessible part of your server (say the root of your site) then all you need is a link to it and it should download:

http://example.com/file.csv
0
 

Author Closing Comment

by:willsherwood
ID: 39643309
thanks - it was a browser setting problem.
0
 
LVL 17

Expert Comment

by:OmniUnlimited
ID: 39643328
Yeah, CSV's are funny that way.  You need to ensure that a bunch of things are in place in order for them to work cross-browser.

I'm glad you found a resolution to your problem.  Thanks for the points!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

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