为什么OVH S3 TEMP URL下载而不是在iframe中显示?
当生成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_disposition
和content_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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论