1

我正在创建一个 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;
4

1 回答 1

0
$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;
于 2014-01-03T06:01:30.833 回答