Create dir hierarchy for files passed to wp_upload_bits().
git-svn-id: https://develop.svn.wordpress.org/trunk@3390 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e6e5cd892f
commit
fce486c48c
@ -940,6 +940,11 @@ function wp_upload_bits($name, $type, $bits) {
|
||||
}
|
||||
|
||||
$new_file = $upload['path'] . "/$filename";
|
||||
if ( ! wp_mkdir_p( dirname($new_file) ) ) {
|
||||
$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file));
|
||||
return array('error' => $message);
|
||||
}
|
||||
|
||||
$ifp = @ fopen($new_file, 'wb');
|
||||
if ( ! $ifp )
|
||||
return array('error' => "Could not write file $new_file.");
|
||||
|
Loading…
Reference in New Issue
Block a user