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

Viewed 99

I have a WordPress website I created inside localhost. I transferred it to a live server but the uploads for PDF documents stopped working. I am using the Formidable Forms plugin. I can upload .docx and .doc documents without an issue. Also, any other formats like .jpg, and .png also don't work.

What I have tried: -Disabling all other plugins and switching theme.

-Updating WordPress to the latest version 6.0

-Switching to a different live server.

-Updating all plugins to the latest versions

-SSL & without SSL

-Upgraded, downgraded PHP versions to test

enter image description here

From the image, you can see that the .PDF and jpg, png appear broken.

Anything I can check?

Inspecting the HTML from the working documents

<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

<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

enter image description here

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. 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)

1 Answers

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. Look at your browser devtools console to see if you can find any more hints about what is wrong.

The first of your IMG tags says this:

<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.

  1. http:. It seems unlikely that a production web site containing private personal data is served via http rather than https. You may be getting mixed-content complaints in your console log.

  2. The path /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. /wp-includes is such a directory.

    The page generated by WordPress and Formidable Forms is not referring to the part of your site holding user-furnished PDF uploads. But, it is correct for your doc and docx uploads. Look at the IMG tags for the images that DO work to get a hint about where those uploads are stored.

Related