PHP文件上传帮助

时间:2011-09-11 00:57:48

标签: php html forms file upload

  

可能重复:
  PHP File Upload Help

<html><head><title>File Upload</title></head>
<body bgcolor = "lavender"><div align = "center">
<?php
if (isset($_FILES['file']) && move_uploaded_file($_FILES['file']['name'],'ftp/' . $_FILES['file']['name']))
{
echo "<font color = 'green'>The file has been uploaded.</font>";
}
else echo "<font color = 'red'>There was an error uploading the file.</font>";
?>
</div></body>
</html>

这是我的代码。我正在尝试使用“get”方法在单独的网页中通过单独的表单上传文件。显示的表单代码如下:

<form enctype="multipart/form-data" action = "fileupload.php" method = "get">
<input type = "file" name = "file"><br>
<input type = "submit" value = "Upload">
</form>

出于某种原因,我继续收到错误消息 - 虽然我很确定我做得对。这是我第一次这样做,建议将不胜感激。

0 个答案:

没有答案