WordPress.org

Make WordPress Core

Changeset 11811


Ignore:
Timestamp:
08/13/09 20:47:13 (6 years ago)
Author:
westi
Message:

Enable the APP attachment file download to work correctly rather than just returning a lot of php notices. Fixes #10372 for 2.8 branch props mysz.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.8/wp-app.php

    r11416 r11811  
    781781 
    782782        $location = get_post_meta($entry['ID'], '_wp_attached_file', true); 
     783        $location = get_option ('upload_path') . '/' . $location;  
    783784        $filetype = wp_check_filetype($location); 
    784785 
     
    790791        header('Connection: close'); 
    791792 
    792         $fp = fopen($location, "rb"); 
    793         while(!feof($fp)) { 
    794             echo fread($fp, 4096); 
    795         } 
    796         fclose($fp); 
     793        if ($fp = fopen($location, "rb")) {  
     794            status_header('200');  
     795            header('Content-Type: ' . $entry['post_mime_type']);  
     796            header('Connection: close'); 
     797 
     798            while(!feof($fp)) { 
     799                echo fread($fp, 4096); 
     800            } 
     801 
     802            fclose($fp); 
     803        } else { 
     804            status_header ('404'); 
     805        } 
    797806 
    798807        log_app('function',"get_file($postID)"); 
Note: See TracChangeset for help on using the changeset viewer.