Howdy. I'm trying to allow users to upload a file via ftp to a directory and I can't get ftp_chdir to work. The manual is not helpful at all. The calling page is www.fakename.com/sam2/additem5.php and I am trying to upload to www.fakename.com/sam2/images. Here's my code after the image has been submitted:

$conn_id = ftp_connect("ftp.fakename.com");
$login_result = ftp_login($conn_id, username, password);
ftp_chdir($conn_id, "ftp.scripsense.com/sam2/images");
ftp_put($conn_id, "testimage.gif",$pic1, FTP_BINARY);

On the browser I get:

Warning: ftp_chdir(): ftp.fakename.com/sam2: No such file or directory in /home/username/www/www/sam2/additem5.php on line 18

I have tried all variations I can think of in ftp_chdir. Can anyone help me with the syntax? Thanks.

    ok, i'm an idiot...all i needed was
    ftp_chdir($conn_id, "sam2/images"); with no slash in front of sam2.

      Write a Reply...