Make WordPress Core

Changeset 35579


Ignore:
Timestamp:
11/09/2015 12:44:01 AM (9 years ago)
Author:
dd32
Message:

Media: Allow media_sideload_image() to work when the upload directory is a PHP Stream. Using copy() instead of rename() allows the function to work across different stream sources.
Props mattheu.
Fixes #29257

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/file.php

    r35315 r35579  
    346346        $move_new_file = @ move_uploaded_file( $file['tmp_name'], $new_file );
    347347    } else {
    348         $move_new_file = @ rename( $file['tmp_name'], $new_file );
     348        // use copy and unlink because rename breaks streams.
     349        $move_new_file = @ copy( $file['tmp_name'], $new_file );
     350        unlink( $file['tmp_name'] );
    349351    }
    350352
Note: See TracChangeset for help on using the changeset viewer.