isset($ _ POST)对我来说不适用于PHP7,我在PHP5的不同服务器上运行完全相同的脚本,并且工作正常。
HTML:
<form name="addItem" method="POST" action="" enctype="multipart/form-data">
<input name="ficheiroMP3" type="file" size="30" accept="audio/mp3" id="ficheiroMP3" />
<input name="submitUpload" id="submitUpload" type="submit" value="Upload" />
</form>
PHP:
if (isset($_POST['submitUpload'])) {
$uploadFileMP3 = "../_mp3/" . "guilt_" . time() . ".mp3";
if (move_uploaded_file($_FILES['ficheiroMP3']['tmp_name'], $uploadFileMP3)) {
echo "SUCCESS";
} else echo "ERROR";
} else var_dump($_POST);
从不执行上传代码,我从 var_dump($ _ POST);
获取 array(0){}