【发布时间】:2014-11-07 08:32:05
【问题描述】:
这是我的 HTML 代码
<HTML>
<HEAD>
<TITLE>Upload a File</TITLE>
</HEAD>
<BODY>
<H1>Upload a File</H1>
<FORM METHOD="POST" ACTION="PHP3.php">
<strong>File to Upload:</strong><br>
<INPUT TYPE="file" NAME="txt1" SIZE="50">
<P><INPUT TYPE="submit" NAME="submit" VALUE="Upload File"></P>
</FORM>
</BODY>
</HTML>
这是我的 PHP 代码
if ($_FILES['txt1'] != '')
{
mkdir("C:/xampp/CIS64/"); //Creates the CIS64 directory
$filename = "C:/xampp/CIS64/"; //Location of where the file will be
copy($_FILES['txt1']['tmp_name'], $filename.$_FILES['txt1']['name']) or die("Couldn't copy the file."); //Copies the uploaded file to the CIS64 directory
}
else
{
die("No input file specified"); //If the file doesn't open, close the program.
}
由于某种原因,我收到错误消息:“未定义索引:第 11 行 C:\xampp\htdocs\PHP3.php 中的 txt1” 它以前工作过,突然停止工作。我的代码有什么问题?
【问题讨论】:
标签: php html indexing undefined