简体   繁体   English

将 PDF 上传到 WordPress 可以在本地主机上工作,但不能在具有强大插件的实时服务器上工作

[英]Uploading PDFs to WordPress works in localhost but not on a live server with Formidable plugin

I have a WordPress website I created inside localhost.我有一个在 localhost 中创建的 WordPress 网站。 I transferred it to a live server but the uploads for PDF documents stopped working.我将它传输到实时服务器,但 PDF 文档的上传停止工作。 I am using the Formidable Forms plugin.我正在使用强大的表单插件。 I can upload .docx and .doc documents without an issue.我可以毫无问题地上传 .docx 和 .doc 文档。 Also, any other formats like .jpg, and .png also don't work.此外,.jpg 和 .png 等任何其他格式也不起作用。

What I have tried: -Disabling all other plugins and switching theme.我尝试过的: - 禁用所有其他插件并切换主题。

-Updating WordPress to the latest version 6.0 - 将 WordPress 更新到最新版本 6.0

-Switching to a different live server. - 切换到不同的实时服务器。

-Updating all plugins to the latest versions - 将所有插件更新到最新版本

-SSL & without SSL -SSL 和没有 SSL

-Upgraded, downgraded PHP versions to test - 升级、降级 PHP 版本进行测试

在此处输入图像描述

From the image, you can see that the .PDF and jpg, png appear broken.从图像中,您可以看到 .PDF 和 jpg、png 出现损坏。

Anything I can check?有什么我可以检查的吗?

Inspecting the HTML from the working documents从工作文档中检查 HTML

<img width="48" height="64" src="http://example.com/wp-includes/images/media/document.png" 
class="attachment-thumbnail size-thumbnail" alt="" loading="lazy">

HTML generated from PDFs documents that don't work从不起作用的 PDF 文档生成的 HTML

<img width="106" height="150" src="http://example.com/frm_file/sample-5-pdf-106x150.jpg" 
class="attachment-thumbnail size-thumbnail" alt="" loading="lazy">

I checked the HTML code inside the upload section and here is what it looks like我检查了上传部分中的 HTML 代码,这就是它的样子

在此处输入图像描述

The code is the same inside localhost and the live server meaning the files get uploaded properly.本地主机和实时服务器中的代码相同,这意味着文件可以正确上传。

But the HTML codes in the first image are different which causes the image to be broken.但是第一张图片中的 HTML 代码不同,这会导致图片被破坏。 It looks like the problem occurs at the point when the placeholder icons that indicate a file has been uploaded should be displayed.看起来问题发生在应该显示指示文件已上传的占位符图标时。 (Correct display HTML in the first image) (正确显示第一张图片中的 HTML)

Your display is certainly failing.你的显示器肯定是失败的。 But you haven't shown us any evidence that your uploads are failing, only your display.但是您没有向我们展示您的上传失败的任何证据,只有您的展示。

Those torn-image icons on your screen shot mean the browser can't find the image mentioned in the <IMG SRC=""> tag.屏幕截图上那些破损的图像图标意味着浏览器无法找到<IMG SRC="">标记中提到的图像。 Look at your browser devtools console to see if you can find any more hints about what is wrong.查看您的浏览器 devtools 控制台,看看您是否可以找到更多关于问题所在的提示。

The first of your IMG tags says this:您的第一个 IMG 标签是这样说的:

<img width="48" height="64" 
     src="http://example.com/wp-includes/images/media/document.png" 
     class="attachment-thumbnail size-thumbnail"
     alt=""
     loading="lazy"
>

That src URL has two problems.该 src URL 有两个问题。

  1. http: . http: It seems unlikely that a production web site containing private personal data is served via http rather than https.包含私人个人数据的生产网站似乎不太可能通过 http 而不是 https 提供服务。 You may be getting mixed-content complaints in your console log.您可能会在控制台日志中收到混合内容的投诉。

  2. The path /wp-includes/images/media/document.png .路径/wp-includes/images/media/document.png It is unlikely that user-furnished media like a passport is stored in a directory owned by WordPress core code.像护照这样的用户提供的媒体不太可能存储在 WordPress 核心代码拥有的目录中。 /wp-includes is such a directory. /wp-includes就是这样一个目录。

    The page generated by WordPress and Formidable Forms is not referring to the part of your site holding user-furnished PDF uploads.由 WordPress 和 Formidable Forms 生成的页面并不是指您网站中保存用户提供的 PDF 上传文件的部分。 But, it is correct for your doc and docx uploads.但是,这对于您的 doc 和 docx 上传是正确的。 Look at the IMG tags for the images that DO work to get a hint about where those uploads are stored.查看图像的 IMG 标签,以获得有关这些上传存储位置的提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM