这是我的 form.php
<form name="form" action="upload.php" method="post" enctype="multipart/form-data">
<?php $id=$_REQUEST['id1']; ?>
<label>Category: </label><?php echo
'<input type="text" name="category" onfocus="blur()" value='.$id.'>'?></br>
<label>Name:</label>
<input type="text" name="name" size="32"></br></br>
<label>Type:</label>
<select name="type">
<option value="Audio">Audio</option>
<option value="Video">Video</option>
<option value="Read">Read</option>
<option value="Quiz">Quiz</option>
</select>
<label>Description:</label></br>
<textarea rows="10" cols="30" name="description"></textarea></br> </br>
<label>File:</label>
<input type="file" name="files"/></br>
<input type="submit" value="upload" name="up">
</form>
和我的upload.php
include("connect.php");
if(isset($_REQUEST['up']))
{
$nagan=$_FILES['files']['name'];
$tmp_loc=$_FILES['files']['tmp_name'];
echo $nagan;
echo $tmp_loc;
$bookCover="modules/".$nagan;
move_uploaded_file($tmp_loc,$bookCover);
$sql="INSERT INTO modules (name, type, description, filename, category)VALUES('$_POST[name]','$_POST[type]','$_POST[description]','$bookCover','$_POST[category]')";
mysql_query($sql);
$count=mysql_affected_rows();
if($count==1)
{
echo "File $nagan Successfully Uploaded!";
}else
echo "Error!";
}
?>
上传图像和 pdf 文件工作正常,但是当我尝试上传音频文件时,它不会显示在指定的文件夹(模块文件夹)中,但它会在数据库中保存一个值。此外,当我尝试上传视频文件时,upload.php 根本不起作用。请帮我。我想弄清楚这两天了。帮助。