Create dir hierarchy for files passed to wp_upload_bits().
git-svn-id: http://svn.automattic.com/wordpress/trunk@3390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c798fede84
commit
b0f69e20a3
|
@ -940,6 +940,11 @@ function wp_upload_bits($name, $type, $bits) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_file = $upload['path'] . "/$filename";
|
$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');
|
$ifp = @ fopen($new_file, 'wb');
|
||||||
if ( ! $ifp )
|
if ( ! $ifp )
|
||||||
return array('error' => "Could not write file $new_file.");
|
return array('error' => "Could not write file $new_file.");
|
||||||
|
|
Loading…
Reference in New Issue