简体   繁体   中英

Whats wrong with my PHP ftp_put?

this is frustrating... I keep getting an error with my ftp_put:

This the error: No such file or directory in /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?

Make sure you are using the right syntax. ftp_put() accepts remote file first and then local file. What is $details in the code?

--Pinaki

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM