Directories not created on replace
-
Hi,
I’m trying to use this plugin to replace missing media files after server data loss. The database is still intact, so it knows that the files used to exist.
In
classes/replacer.php
line ~86,move_uploaded_file()
is used. However, this will not create the folder if it doesn’t already exist. Just before that file, this plugin should check if the directory exists and if not, create the directory.Something like the following, just before line 86, should solve the issue.
$targetFilePath = substr($targetFile, 0, (strrpos($targetFile, "/"))); if (!is_dir($targetFilePath)) { wp_mkdir_p($targetFilePath); } /* @todo See if wp_handle_sideload / wp_handle_upload can be more securely used for this */ $result_moved = move_uploaded_file($file,$targetFile);
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Directories not created on replace’ is closed to new replies.