Make WordPress Core


Ignore:
Timestamp:
03/09/2007 08:14:52 PM (20 years ago)
Author:
ryan
Message:

Change xmlrpc upload logic. Props Joseph Scott.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r4990 r5008  
    10951095}
    10961096
    1097 function wp_upload_bits($name, $type, $bits, $overwrite = false) {
     1097function wp_upload_bits($name, $type, $bits) {
    10981098        if ( empty($name) )
    10991099                return array('error' => __("Empty filename"));
    … …  
    11231123        }
    11241124
    1125         // If we are asked to over write the file then make sure
    1126         // the $name has the complete path and is writable.
    1127         if($overwrite) {
    1128                 if(!is_writable($name)) {
    1129                         return(array("error" => __("Can not over write file.")));
    1130                 }
    1131                 $new_file = $name;
    1132                 $filename = basename($name);
    1133         }
    1134         else {
    1135                 $new_file = $upload['path'] . "/$filename";
    1136                 if ( ! wp_mkdir_p( dirname($new_file) ) ) {
    1137                         $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file));
    1138                         return array('error' => $message);
    1139                 }
     1125        $new_file = $upload['path'] . "/$filename";
     1126        if ( ! wp_mkdir_p( dirname($new_file) ) ) {
     1127                $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file));
     1128                return array('error' => $message);
    11401129        }
    11411130
    … …  
    11521141        @ chmod($new_file, $perms);
    11531142
    1154         // Compute the URL if this is a new file.
     1143        // Compute the URL
    11551144        $url = $upload['url'] . "/$filename";
    1156         if($overwrite) {
    1157                 $url = $name;
    1158         }
    11591145
    11601146        return array('file' => $new_file, 'url' => $url, 'error' => false);
Note: See TracChangeset for help on using the changeset viewer.