views:

41

answers:

2

Hi, 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.

A: 

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

pinaki
+1  A: 

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?

Tatu Ulmanen
Yup, I'm trying to upload from my computer to the server, $details['tmp_name'] is from a submitted file from a posted form.
Smickie