当我在空白的html页面上使用此代码时,它可以正常工作:
<form enctype="multipart/form-data" action="upload_file.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
但是当我将它添加到下面的代码时它只是停止并且没有连接到脚本upload_file.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="Student/ChatterBoxDir/ChatterBox.css" type="text/css" rel="stylesheet" />
<link href="MyCSS.css" type="text/css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<div class="box">
<div class="header">
<div class="logo" style="width: 300px; height: 159px">
<img src="http://www.mockcourt.org.uk/pics/background - Teacher.png" width="990" height="181" border="0" alt="">
</div>
<div class="auto-style1" style="height: 78px">
<div class="headerimages">
<div style="position:absolute; left:555px; top:92px; style="width: 28px; height: 28px;">
<a href="http://www.mockcourt.org.uk/teacher/default.aspx">
<img src="http://www.mockcourt.org.uk/pics/home - teacher.png" width="28" height="28" /></a>
</div>
<div class="headerimages">
<div style="position:absolute; left:611px; top:92px; style="width: 28px; height: 28px;">
<a href="http://www.mockcourt.org.uk/pics/2012/default.asp">
<img src="http://www.mockcourt.org.uk/pics/gallery - teacher.png" width="28" height="28" /></a>
</div>
<div class="headerimages">
<div style="position:absolute; left:674px; top:92px; style="width: 28px; height: 28px;">
<a href="http://www.mockcourt.org.uk/Teacher/Uploads/show_resources.aspx">
<img src="http://www.mockcourt.org.uk/pics/resources - teacher.png" width="28" height="28" /></a>
</div>
<div style="position:absolute; left:835px; top:92px; style="width: 28px; height: 28px;">
<a href="http://www.mockcourt.org.uk/student/calendar.aspx">
<img src="http://www.mockcourt.org.uk/pics/calendar - teacher.png" width="28" height="28" /></a>
</div>
<div style="position:absolute; left:753px; top:92px; style="width: 28px; height: 28px;">
<a href="http://www.mockcourt.org.uk/upload picture.html">
<img src="http://www.mockcourt.org.uk/pics/management - teacher.png" width="28" height="28" /></a>
</div>
<div style="position:absolute; left:894px; top:92px; style="width: 28px; height: 28px;">
<a href="http://www.mockcourt.org.uk/TT/Phone.aspx">
<img src="http://www.mockcourt.org.uk/pics/chat - teacher.png" width="28" height="28" /></a>
</div>
<div style="position:absolute; left:945px; top:92px; style="width: 28px; height: 28px;">
<a href="http://www.mockcourt.org.uk/shop.html">
<img src="http://www.mockcourt.org.uk/pics/Links - Teacher.png" width="28" height="28" /></a>
</div>
<div style="position:absolute; left:845px; top:150px; style="width: 128px; height: 10px;">
<a href="http://www.mockcourt.org.uk//ChangePassword/ChangePassword.aspx">
<img src="http://www.mockcourt.org.uk/pics/change password.png" width="128" height="13" /></a>
</div>
它停止工作。我确信这是非常愚蠢的事情。任何人都可以看到问题所在。
由于 罗斯
答案 0 :(得分:2)
您已在<body>
标记下的页面上打开了表单标记:
<form id="form1" runat="server">
您不能在表单中使用表单。
答案 1 :(得分:0)
把
<form enctype="multipart/form-data" action="upload_file.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
在的结束标记下
<form id="form1" runat="server">