Я создаю плагин wordpress и пытаюсь создать функцию загрузки. Однако я получаю следующие ошибки:
Warning: move_uploaded_file(logos/5041796eeedf21346468206.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/plugins/logo-updating/logo_menu.php on line 15 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/Applications/XAMPP/xamppfiles/temp/phpeIJRwj' to 'logos/5041796eeedf21346468206.jpg' in /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/plugins/logo-updating/logo_menu.php on line 15
Мой код для загрузки:
$tmp = $_FILES['logoUpload']['tmp_name']; $extension = explode(".", $_FILES['logoUpload']['name']); $everything = count($extension); $ext = $extension[$everything - 1]; $newName = uniqid().time().".".$ext; $newName2 = uniqid().time()."_banner.".$ext; move_uploaded_file($tmp, "logos/".$newName); $fullLink = "logos/".$newName;
$path_array = wp_upload_dir(); $path = str_replace('\\', '/', $path_array['path']); $target_path_sia = uniqid().$_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"],$path. "/" . $target_path_sia); echo "Stored in: " . $path. "/" .$target_path_sia;