move_uploaded_file()wordpress插件 [英] move_uploaded_file() wordpress plugin
问题描述
我正在创建一个wordpress插件并尝试创建一个上传功能。但是,我得到这些错误:
$ p $ 警告:move_uploaded_file(标志/ 5041796eeedf21346468206.jpg)[function.move-uploaded-文件]:无法打开流:第15行中的/Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/plugins/logo-updating/logo_menu.php中没有这样的文件或目录
警告:move_uploaded_file()[function.move-uploaded-file]:无法在/ Applications / XAMPP / xamppfiles / htdocs / wordpress / wp中将'/ Applications / XAMPP / xamppfiles / temp / phpeIJRwj'移动到'logos / 5041796eeedf21346468206.jpg' -content / plugins / logo-updates / 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']);
$ b $ target_path_sia = uniqid()。$ _ FILES [file] [name];
move_uploaded_file($ _ FILES [file] [tmp_name],$ path。/。$ target_path_sia);
回声存储在:。 $路径。 /。$ target_path_sia;
I'm creating a wordpress plugin and trying to create an upload function. However, I'm getting these errors:
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
My code for uploading:
$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;
这篇关于move_uploaded_file()wordpress插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!