• Hi, I know this is a weird problem, but I need some help sorting it out.

    I had a lot of PDF files on the repository.
    After a failed migration to my current host I paid the host to complete the migration and the links to all the old PDF worked fine (spot checked about half a dozen).
    Today I discovered those links work and they do not show in the repository.
    When I try to download them, I do get something, but they will not open and the different readers report that the file is invalid type or corrupted. So I’m not sure what they are accessing or where as they don’t show in my repository list of documents.

    All plugins turned off and I restarted the ones I need for SSL and the repository. None of the fixes in the forums related to PDFs or corrupted files worked for me.

    Is it possible with the migration I had to repository databases?
    there are many mySql databases on my instance, what databases/string should I search for to ID where my documents are? Also, does anybody know what I should be looking for in the PDF; it has content of some sort but doesn’t seem to have a header.

    I have tried this on current versions firefox,chrome,edge and safari on win19, mac and android. The host is shared host running linkux, but I don’t know whick version.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter misterjolly

    (@misterjolly)

    Are the stored documents just kept in the wp-contemts/uploads dir? Is it possible to copy from one installation directory to another one?

    Thread Starter misterjolly

    (@misterjolly)

    update: There are, in fact, two word press installs here.
    I have recovered the files, but they are all named with a GUID. I rename them and re-upload them. When I try to re-download them I get the same error. This now seems to be an issue with the plugin as ‘ve updated hte WP and plugin version to match on both install.

    Any Ideas?

    Plugin Contributor nwjames

    (@nwjames)

    @misterjolly,
    I can give you some pointers.

    When I enter the URL I see that it is looking to open the file but not succeeding.

    So I but debug on and looked for the response. It is 126k long starting
    H4sIAAAAAAAAA8z9U9AwUbMlDD62bdu2bdu2jfexbdu2 – so not a PDF file at all.

    Since one of the request headers states that your browser will accept Gzip I pushed that into an online Gzip convertor. The output started

    %PDF-1.6
    %a??ó
    43 0 obj
    <</Filter/FlateDecode/First 39/Length 567/N 6/Type/ObjStm>>stream

    and ended
    %%EOF
    so it looks as though you received a gzip file.

    I do find a problem to display the file – but this is because PDFs contain binary data and its a UTF-8 to windows conversion problem to display. But this is not the cause of the problem.

    Since version 3.2.4 (the latest version from WordPress uses the PHP function readfile to deliver the file, it is not compressed. You should check that the file as held on the server is actually a PDF file, rather than a Gzip file.

    To your other questions.

    1. Where are the documents held?
    They are held where you have configured them to be stored. By default, this is the uploads directory. You can see where you have configured them to be by going to the Admin screen and looking for Settings -> Media, then in the section Uploading Files it will have an item called Document Upload Directory. That is where they are stored.

    Assuming that you have copied over the document posts and their metadata then you should just copy the file as is from the old location to the new one.

    2. What are their names?
    It does NOT store the file by its original name, but a MD5 encoded version of the original name and the upload time.
    So when loading a file called file.pdf, it will form a hashed name like c97fdf8802e0055cee048837835dcda0. This will be used as the post title and post name of the attachment record. The post_mime_type will be set to the relevant value for the file that was loaded (determined from the extension).
    The attachment record will have a meta record attached with key _wp_attached_file containing
    2021/05/c97fdf8802e0055cee048837835dcda0.pdf which combined with the upload directory will give you the full path name to the actual file.

    You may also find a file called c97fdf8802e0055cee048837835dcda0.pdf.jpg in the same directory as the document. This is standard WP processing creating a thumbnail for the attachment.

    Hope this gives you some pointers,
    Neil James

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can I get some information how/where files are stored? All Pfiles seem corrupted’ is closed to new replies.