为什么OVH S3 TEMP URL下载而不是在iframe中显示?

发布于 2025-02-14 01:46:38 字数 890 浏览 0 评论 0原文

当生成OVH S3 tempurl指向HTML文件并将其添加到Iframe的SRC属性中时,该文件将下载而不是显示。

<iframe style="width:100%;max-width:860px;display:block;margin:auto;padding:50px; border:none;" scrolling="no" src="https://storage.GRA.cloud.ovh.net/v1/AUTH_09b2a1dadcfb457dbcf5b28deebae0bc/XXXXX/cms/35/es/testdoc35/html?temp_url_sig=50532a640d1dceb3290a63a9a0cabd6c57462d0e&temp_url_expires=1657349539"></iframe>

我会得到这样的URL:

 $url = Storage::disk('ovh')->temporaryUrl($path, now()->addMinutes(1),   [
            'CONTENT_DISPOSITION' => 'inline',
            'CONTENT_TYPE' => 'text/html'
        ]);

尽管content_dispositioncontent_type似乎被忽略了。

关于如何显示文件而不是下载该文件的任何线索?

我知道我可以做返回存储:: disk('ovh') - &gt; get($ path);,但这就是我要避免的。我希望iframe直接从S3加载内容。

使用Laravel 9

When generating an OVH S3 tempURL pointing to an HTML file and adding it to an iframe's src attribute, the file gets downloaded instead of displaying it.

<iframe style="width:100%;max-width:860px;display:block;margin:auto;padding:50px; border:none;" scrolling="no" src="https://storage.GRA.cloud.ovh.net/v1/AUTH_09b2a1dadcfb457dbcf5b28deebae0bc/XXXXX/cms/35/es/testdoc35/html?temp_url_sig=50532a640d1dceb3290a63a9a0cabd6c57462d0e&temp_url_expires=1657349539"></iframe>

I'm getting the URL like this:

 $url = Storage::disk('ovh')->temporaryUrl($path, now()->addMinutes(1),   [
            'CONTENT_DISPOSITION' => 'inline',
            'CONTENT_TYPE' => 'text/html'
        ]);

Although CONTENT_DISPOSITION and CONTENT_TYPE seems to be ignored.

Any clue on how can I display the file instead of downloading it?

I know I can do return Storage::disk('ovh')->get($path);, but that's what I'm trying to avoid. I would like the iframe to load the content directly from the S3.

Using Laravel 9

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文