如何命名要在 Firefox 上下载的文件? [英] How to name a file for download on Firefox?

查看:25
本文介绍了如何命名要在 Firefox 上下载的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下标题适用于 IE,但不适用于 FF

The following headers work on IE but not on FF

<%@ Page Language="C#" ContentType="text/csv" Inherits="System.Web.Mvc.ViewPage"%>
<% Response.AddHeader("Content-Disposition", "filename=report.csv;attachment"); %>

在 FF 中,FF 中的建议名称显示为没有扩展名的report".

In FF the suggested name in FF appears as "report" without the extension.

推荐答案

我目前使用的代码如下所示:

I am currently using code that looks like this:

response.AddHeader("Content-Disposition", "attachment; filename="data.csv"");

在我的日常工作中 - 效果很好.此外,您确定这不是您的操作系统或启用了隐藏已知文件类型的扩展名"选项的任何东西?(我知道 Windows 有这个选项,这让我发疯)

In my daily work - and that works just fine. Also are you sure this is not your OS or anything that has the "Hide extensions for known file types"-option enabled? (I know Windows have this option and it drives me crazy)

这篇关于如何命名要在 Firefox 上下载的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆