PHP文件上传帮助 [英] PHP File Upload Help
本文介绍了PHP文件上传帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<html><head><title>File Upload</title></head>
<body bgcolor = "lavender"><div align = "center">
<?php
if (isset($_FILES['file']) && move_uploaded_file(
$_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方法在单独的网页中通过单独的表单上载文件。
这里显示的代码如下所示:
This is my code. I am trying to upload a file via a seperate form in a seperate webpage, using the method 'get'. The code to the form as shown is here:
<form enctype="multipart/form-data" action = "fileupload.php" method = "get">
<input type = "file" name = "file"><br>
<input type = "submit" value = "Upload">
</form>
出于某种原因,我一直在收到错误消息 - 虽然我很确定我在做对的。这是我第一次这样做,建议将不胜感激。
For some reason I keep on getting the error message - although I'm pretty sure I'm doing it right. This is my first time doing this, suggestions would be appreciated.
推荐答案
它应该是tmp_name
it should be tmp_name
if (isset($_FILES['file']) && move_uploaded_file($_FILES['file']['tmp_name'],'ftp/' . $_FILES['file']['name']))
不发送作为GET
<form enctype="multipart/form-data" action = "fileupload.php" method = "post">
(改为发表)
这篇关于PHP文件上传帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文