[英]Whats wrong with my PHP ftp_put?
this is frustrating... I keep getting an error with my ftp_put: 这令人沮丧...我的ftp_put不断出现错误:
This the error: No such file or directory in /Users/xxxx/Documents/Work/something 这是错误消息:/ Users / xxxx / Documents / Work / something中没有这样的文件或目录
Is there any glaring errors in my code I'm blind to? 我看不到的代码中有任何明显的错误吗?
$server = "79.170.40.xxx";
$connection = ftp_connect($server);
$login = ftp_login($connection, "xxx.xxx.co.uk", "xxx");
if (!$connection || !$login) { die('Connection attempt failed!'); }
$upload = ftp_put($connection, '/home/sites/xxx.xxx.co.uk/public_html/dev/uploads/training/powerpoints/' . $filename, $details['tmp_name'], FTP_ASCII);
if (!$upload) { echo 'FTP upload failed!'; }
ftp_close($connection);
Cheers. 干杯。
To me, it would appear that you're trying to upload a file that doesn't exist in the server (in this case it seems that you're doing this locally, so the file doesn't exist on your machine). 对我来说,您似乎正在尝试上载服务器中不存在的文件(在这种情况下,您似乎是在本地执行的,因此该文件在您的计算机上不存在)。
Where does $details['tmp_name']
come from, and are you sure it is a valid path and file? $details['tmp_name']
是从哪里来的,您确定它是有效的路径和文件吗?
Make sure you are using the right syntax. 确保使用正确的语法。 ftp_put() accepts remote file first and then local file.
ftp_put()首先接受远程文件,然后接受本地文件。 What is $details in the code?
代码中的$ details是什么?
--Pinaki -皮纳基
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.