打开“文件”从内存流?

发布于 2024-08-12 12:19:56 字数 134 浏览 1 评论 0原文

我想知道这是否可能。我正在从数据库(blob)返回文件并将它们作为字节数组。我想让用户通过单击关联对象来显示数据内容 - 类似于在 Web 浏览器中打开,它会自动选择适当的程序..但我知道我需要将文件保存到磁盘。 是否有其他解决方案仅适用于流/字节数组?

I am wondering if its even possible. I am returning files from database (blob) and have them as bytes array. I would like to let the user to show the data content by clicking on associated object - something like opening in the WebBrowser which automatically selects the appropriate program..but I understand I would need to save the file to the disk.
Is there any other solution which would work only from streams/byte arrays?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

平生欢 2024-08-19 12:19:56

您可以尝试设置 WebBrowser.DocumentStream 属性:

browser.DocumentStream = new MemoryStream(blob);

You could try setting the WebBrowser.DocumentStream property:

browser.DocumentStream = new MemoryStream(blob);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文