我正试图通过PHP上传一个json文件。这是我所拥有的代码。
if( isset( $_POST[\'upload\'] )) {
$target = "/";
$target = $target . basename( $_FILES[\'upload\'][\'name\']) ;
if(move_uploaded_file($_FILES[\'upload\'][\'tmp_name\'], $target))
{
echo "The file ". basename( $_FILES[\'uploadedfile\'][\'name\']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
}
我有一个浏览按钮和一个导入按钮,当我按下导入时,它什么也没说。
echo \'<div class="wrap">\';
echo "<form action=\'\' method=\'post\' enctype=\'multipart/form-data\'><input type=\'file\' name=\'upload\' value=\'Upload\' id=\'upload\' /></form>";
echo \'</div>\';
echo \'<div class="wrap">\';
echo "<form action=\'\' method=\'post\'><input class=\'button-secondary\' type=\'submit\' name=\'import\' value=\'Import\' id=\'import\' /></form>";
echo \'</div>\';
这是按钮的代码。
你知道我该如何解决这个问题吗?