上传文件到服务器时遇到问题…这是我的表单:
<form action="./status/UploadStatus.php" method="POST" id="PhotoPost">
<textarea style="width: 100%;" rows="5" placeholder="Geef commentaar bij je foto..." name="data"></textarea>
<input type="file" name="media" size="50" accept="Image/*">
<input type="hidden" name="type" value="p">
<input type="hidden" name="owner" value="<?php echo $u;?>">
<input type="hidden" name="author" value="<?php echo $log_username;?>">
<input type="submit" name="submit" value="Upload!" id="UploadStatus">
</form>
我的uploadstatus。php是这样的:
...
$name = $_FILES['media']['name'];
$tmp_name = $_FILES['media']['tmp_name'];
$ext = pathinfo($name, PATHINFO_EXTENSION);
但不知何故,它没有捕获文件名或上传文件的任何其他内容…有人发现问题了吗?
您忘记在表单字段enctype=multipart/form-data1
中写入