Solved

HTML content-disposition header equivalent in a URL link

Posted on 2013-11-12
3
471 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

929 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

10 Experts available now in Live!

Get 1:1 Help Now