通过 FTP 使用 WinSCP 上传文件的命令?
我有一个 FTP 服务器,但不知道从 PHP 表单上传的命令。我需要一个用 WinSCP 上传的命令。到目前为止我的代码如下:
<html>
<body>
<?php
if(isset($_FILES["uploaded"]))
{
print_r($_FILES);
if(move_uploaded_file($_FILES["uploaded"]["tmp_name"],"<root>/domains/sigaindia.com/public_html/reymend/".$_FILES["uploaded"]["name"]))
echo "FILE UPLOADED!";
}
else
{
print "<form enctype='multipart/form-data' action='fup1.php' method='POST'>";
print "File:<input name='uploaded' type='file'/><input type='submit' value='Upload'/>";
print "</form>";
}
?>
</body>
</html>
I have an FTP server, but don't know the command to upload from a PHP form. I need a command to upload with WinSCP. My code so far is below:
<html>
<body>
<?php
if(isset($_FILES["uploaded"]))
{
print_r($_FILES);
if(move_uploaded_file($_FILES["uploaded"]["tmp_name"],"<root>/domains/sigaindia.com/public_html/reymend/".$_FILES["uploaded"]["name"]))
echo "FILE UPLOADED!";
}
else
{
print "<form enctype='multipart/form-data' action='fup1.php' method='POST'>";
print "File:<input name='uploaded' type='file'/><input type='submit' value='Upload'/>";
print "</form>";
}
?>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://au.php.net/manual/en/book.ftp.php
http://au.php.net/manual/en/book.ftp.php
如果您谈论的是 PHP 和表单,那么那就是 HTTP - HTTP 不是 FTP,反之亦然。
WinSCP 是一个 SSH 客户端。 SSH 是与 HTTP 不同的协议。 SSH 是与 FTP 不同的协议。
如果您希望 PHP 脚本将上传到 Web 服务器的文件传输到 FTP 服务器,请尝试以下操作:
If you're talking about PHP and forms than that's HTTP - HTTP is not FTP and vice versa.
WinSCP is an SSH client. SSH is a different protocol from HTTP. SSH is a different protocol from FTP.
If you want your PHP script to transfer files uploaded to the webserver to an FTP server, try something like: