Home  >  Q&A  >  body text

Uploading PDF to WordPress works on localhost but not on live server using Formidable plugin

I have a WordPress website created within localhost. I moved it to a live server but the upload of the PDF document stopped working. I'm using the Formidable Forms plugin. I can upload .docx and .doc documents without any problem. Additionally, any other formats such as .jpg and .png will not work.

What I tried: -Disable all other plugins and switch themes.

-Update WordPress to the latest version 6.0

- Switch to a different live server.

-Update all plugins to the latest version

-SSL and No SSL

-Upgrade, downgrade PHP version to test

From the image, you can see that the .PDF and jpg, png are corrupted.

Is there anything I can check?

Check the HTML in the working document

<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 PDF document does not 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 as shown below

The code inside localhost and live server is the same, which means the file is uploaded correctly.

But the HTML code in the first image is different, causing the image to be corrupted. It looks like the problem occurs when a placeholder icon should be displayed indicating that the file has been uploaded. (Correctly displays the HTML in the first image)

P粉785957729P粉785957729228 days ago392

reply all(1)I'll reply

  • P粉587970021

    P粉5879700212024-03-29 13:01:04

    There must be something wrong with your monitor. But you didn't show us any evidence that your upload failed, only your display.

    Those broken image icons on the screenshot mean that the browser cannot find the image mentioned in the tag. Check your browser developer tools console to see if you can find more hints about the problem.

    Your first IMG tag looks like this:

    
    

    There are two problems with this src URL.

    1. http:. It seems unlikely that a production website containing private personal data would be served over http rather than https. You may receive mixed content complaints in your console logs.

    2. Path/wp-includes/images/media/document.png. It is unlikely that user-supplied media (such as a passport) is stored in a directory owned by the WordPress core code. /wp-includes is such a directory.

      The pages generated by WordPress and Formidable Forms do not refer to the part of your website that holds user-supplied PDF uploads. However, it is correct for the doc and docx you uploaded. Look at the IMG tags of the images that do work to get a hint as to where these uploads are stored.

    reply
    0
  • Cancelreply