myfile.csv 文件保存为 myfile.csv.txt
我在从浏览器保存 .csv 文件时遇到问题。
我创建了一个文件 myfile.csv 并从数据库中添加了行,然后我要求用户右键单击并保存页面。但在许多浏览器中(因为某些浏览器想要向其添加 .txt 属性),它被保存为 myfile.csv.txt 格式。
大多数人不知道从文件名中删除 .txt 部分,那么是否可以将其调整为始终为 .csv 格式?
我可以向 .htaccess 添加指令来识别 .csv 文件吗?但不确定。
请告诉我您的想法如何做到这一点。
任何帮助/想法将不胜感激。 提前致谢。
I am facing a problem while saving a .csv file from browser.
I made a file myfile.csv and added rows into it from my database, and i asked the users to right click and save the page. But in many browser (because some browsers want to add the .txt properties to it) it is getting saved as myfile.csv.txt format.
Most people wouldn’t know to delete the .txt part from the file name so can this be adjusted to always be a .csv format?
can i add a directive to the .htaccess to recognize .csv files? Not sure though.
Please let me know what you think how this can be done.
Any help/idea would be appreciated.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能是 MIME 类型问题。浏览器有时习惯于不一致地使用文件名(扩展名)或 MIME 类型,而忽略另一个。由于不同的浏览器对它的处理方式不同,如果您希望正确处理它,您应该确保它们匹配。
Could be a MIME type issue. Browsers sometimes have the habit of inconsistently using either the file name (extension) or MIME type, but ignoring the other. Since different browsers handle it differently you should make sure they match if you want it handled properly.