~canonical-sysadmins/wordpress/3.9.x

« back to all changes in this revision

Viewing changes to wp-app.php

  • Committer: Chris Jones
  • Date: 2009-11-12 19:39:15 UTC
  • Revision ID: cmsj@tenshu.net-20091112193915-tar3mrp53whe6e4t
[CJ] Import wp 2.8.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
780
780
                }
781
781
 
782
782
                $location = get_post_meta($entry['ID'], '_wp_attached_file', true);
 
783
                $location = get_option ('upload_path') . '/' . $location; 
783
784
                $filetype = wp_check_filetype($location);
784
785
 
785
786
                if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
789
790
                header('Content-Type: ' . $entry['post_mime_type']);
790
791
                header('Connection: close');
791
792
 
792
 
                $fp = fopen($location, "rb");
793
 
                while(!feof($fp)) {
794
 
                        echo fread($fp, 4096);
 
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');
795
805
                }
796
 
                fclose($fp);
797
806
 
798
807
                log_app('function',"get_file($postID)");
799
808
                exit;