• Resolved jeffnschofield

    (@jeffnschofield)


    Office files and zip files are corrupted when downloading from Memphis Docs, pdf files are good. Files are good when downloaded from ftp.

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

Viewing 15 replies - 1 through 15 (of 16 total)
  • I have the same problem with Excel files – can’t open, corrupted. Pdf files are fine.

    Plugin Author bhaldie

    (@bhaldie)

    if you do a regular upload to media does this issue still occur?

    I have uploaded a fresh Excel-file, when I then download this file from Memphis Docs it is corrupt.
    I compared the two files, they where the same size, but the coding seemed different.
    So I converted the downloaded corrupt file from UTF-8-BOM to ANSI and saved it. When I then opened it with Excel, I had the option to repair it. Now it opens in Excel without any error.
    The same happens to PDF-files, but the PDF-Reader seems to be more tolerant.

    Regular uploads to Media-Files and downloads via link work fine.

    • This reply was modified 5 years, 5 months ago by tpm. Reason: I forgot to mention regular up- and download
    Plugin Author bhaldie

    (@bhaldie)

    Are you running a Windows Server?

    Im looking into issues with BOM file and have found lots of information but no solution yet.

    I may need you to help me test solutions moving forward.

    No, our system is an intranet running on CentOS 7 with Apache/2.4.6, PHP/7.3.6, MariaDB/10.1.40 and WordPress/5.2.1 (Multisite).

    I will give you any possible help to find a solution.

    Plugin Author bhaldie

    (@bhaldie)

    can you tell me what the encoding differences is. Is it an extra first line?

    I have create a Testfile (Testfile-ORIGINAL.xlsx) and uploaded it to our site. Then I downloaded it via mDocs (Testfile-DOWNLOAD.xlsx). You will find both files here https://we.tl/t-daqhMUWC6v

    Plugin Author bhaldie

    (@bhaldie)

    please download this file unzip it and replace it with the one in the includes folder of mdocs.

    mdocs-filenames-to-latin.php

    • This reply was modified 5 years, 5 months ago by bhaldie.

    Sorry, the patch did not change anything!

    Plugin Author bhaldie

    (@bhaldie)

    try this open the file mdocs-downloads.php and edit line 60:

    
    //else header('Content-Disposition: attachment; filename="'.$filename.'"');
    else  header('Content-Disposition: attachment; filename='.iconv('UTF-8', 'ASCII//TRANSLIT', $filename));
    
    • This reply was modified 5 years, 5 months ago by bhaldie.

    Done – again no success.

    I guess you try to fix the filename, but I have problems with the content of the file.

    Plugin Author bhaldie

    (@bhaldie)

    what happens when you upload a file to the normal WordPress Media folder. Does the same thing happen or is the file okay?

    When I upload the file to the normal WP Media folder and put a link into a page, the downloaded file ist ok.

    Plugin Author bhaldie

    (@bhaldie)

    convert the file mdocs-downloads.php back to original. then change line 58 to this:

    
    header('Content-Type: '.$filetype['type'].' charset=utf-8');
    

    report back.

    In my case, this problem was solved by replacing

    ob_clean()

    in function: mdocs_load_plugins_for_download()

    with:

    
    while (ob_get_level()) {
        ob_end_clean();
    }
    

    in file: mdocs-downloads.php.

    Reference: https://stackoverflow.com/questions/13311790/php-readfile-causing-corrupt-file-downloads

    • This reply was modified 5 years, 3 months ago by awijasa. Reason: Added a reference
Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Office and zip files corrupted when downloaded’ is closed to new replies.