Enable the APP attachment file download to work correctly rather than just returning a lot of php notices. Fixes #10372 for trunk props mysz.
git-svn-id: https://develop.svn.wordpress.org/trunk@11810 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
19c135e0e6
commit
31387fd45c
17
wp-app.php
17
wp-app.php
@ -780,6 +780,7 @@ EOD;
|
|||||||
}
|
}
|
||||||
|
|
||||||
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
|
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
|
||||||
|
$location = get_option ('upload_path') . '/' . $location;
|
||||||
$filetype = wp_check_filetype($location);
|
$filetype = wp_check_filetype($location);
|
||||||
|
|
||||||
if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
|
if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
|
||||||
@ -789,11 +790,19 @@ EOD;
|
|||||||
header('Content-Type: ' . $entry['post_mime_type']);
|
header('Content-Type: ' . $entry['post_mime_type']);
|
||||||
header('Connection: close');
|
header('Connection: close');
|
||||||
|
|
||||||
$fp = fopen($location, "rb");
|
if ($fp = fopen($location, "rb")) {
|
||||||
while(!feof($fp)) {
|
status_header('200');
|
||||||
echo fread($fp, 4096);
|
header('Content-Type: ' . $entry['post_mime_type']);
|
||||||
|
header('Connection: close');
|
||||||
|
|
||||||
|
while(!feof($fp)) {
|
||||||
|
echo fread($fp, 4096);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fp);
|
||||||
|
} else {
|
||||||
|
status_header ('404');
|
||||||
}
|
}
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
log_app('function',"get_file($postID)");
|
log_app('function',"get_file($postID)");
|
||||||
exit;
|
exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user