×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

CSV files , how to always allow file downloads

CSV files , how to always allow file downloads

CSV files , how to always allow file downloads

(OP)
Hi,

I'm having a nightmare getting IE to download simple CSV files.

The CSV is genarated via a form submission and i've tried two methods as follows...

1. window.open..

This keeps bleeping without any info bar or message, I added the domain to popup blocker, no good, I added domain to trusted sites, still no good, I then had to edit custom level for trusted sites and enable 'prompting' for file downloads.

Finanly this works, the problem is this is in no way user friendly, average Joe doesn't know how to edit these settings, nor should average Joe have to, especially considering the potential for opening your PC up to serious securtiy risk by mistake and changing wrong settings.

2. document.location.href

This method doesn't require any browser settings to be altered, however, every time the CSV file is requested, the info bar pops up saying it has blocked the file download and you have to right click and accept the download, only the file doesn't download the browser refreshes itself, the webpage is reset and you have to re-request the file, only then will it actually download.

I cannot find anyway of telling IE to allow these downloads from this domain, doing all the browser setting as per option 1 makes no difference and the download info bar pop-up continues to show.

Is there any way round this nightmare? I don't have any problems with either method in firefox!

In my server side code i've tried printing the content to the browser as both dispositions (inline / attachment) it doesn't make any difference.

can anyone help?

Thanks 1DMF.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> PERL v1.5 beta (FusionCharts)

RE: CSV files , how to always allow file downloads

(OP)
it is server with text/csv

here is the full header details in the perl code..

CODE

    print "Content-type: text/csv\n";
    print "Content-disposition: inline; filename=\"myfilename.csv\"\n\n";

I've even tried...

CODE

print "Content-type: text/x-comma-separated-values\n";
    print "Content-disposition: inline; filename=\"myfilename.csv\"\n\n";
as well as text/plain

nothing will stop the file download info bar message and the page reloading after selecting to download the file!

it's extrememly annoying and i'm getting the feeling there is no way wound it in IE.

I really hate to say this, but I might have to start using firefox!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> PERL v1.5 beta (FusionCharts)

RE: CSV files , how to always allow file downloads

(OP)
hmm, well the second one sends you to MSKB's relating only to I.E. 1 - 5.5 and file type association, which isn't the problem.

the first looks interesting though having done a quick search I can't find the perl equivilent to

CODE

session_cache_limiter("public");

It also seems odd that they are recommending sending an application/octet-stream mime type for a plain text ASCII CSV file.

I've tried the octet-steam and it hasn't made any difference.

But the thread does say the session-cache is the key, so I guess I need to find the perl equivilent...

At least i'm not the only one who's been pulling their hair out over this!


 

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> PERL v1.5 beta (FusionCharts)

RE: CSV files , how to always allow file downloads

(OP)
well I went and looked up the PHP command and it seems it sends the HTTP headers

CODE

Expires: (sometime in the future, according session.cache_expires)
Cache-Control: public, max-age=(sometime in the future, according to session.cache_expire
Last-Modified: (the timestamp of when the session was last saved)
, well I added

CODE

Cache-Control:public
as well as used octet-stream and i'm still getting the 'windows has stop the file from downloading' security info bar message.

I use the same code for a direct hyperlink and mp3 files and don't have these problems.

Basically a webform fires a perl script with a query string via AJAX, the result is returned to the script which is authentication that the CSV file can be obtained..

the JS then tries to get the CSV file by either of the methods I mention, yet it won't work.

What's really annoying is, if I just change the file extension from .csv to .mp3 , the code works and Windows Media Player instantly opens and tries to play the file.

As soon as it's changed back to .csv, I get the file security problem!

Any other ideas?



 

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> PERL v1.5 beta (FusionCharts)

RE: CSV files , how to always allow file downloads

The easiest way is with Group Policy.

Computer Configuration / Administrative Templates / Windows Components / Internet Explorer / Security FEATURES (?) / Restrict File Download /

It's also helpful to disable the information bar warning FEATURE (?) which is just below the above setting.

 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close