----- Original Message ----- From: "Wade Smart" 03242008 1830 GMT-6
Im working on a ftp script and right now Im just learning from the script on the php site. This line: $upload = ftp_put($connection_id, $destination_file, $source, FTP_BINARY); Im having trouble with: $destination_file destination file is the remote file path. So I assume that to be ftp.servername.com / root /images images directory so I put $destination_file = "/images"; Warning: ftp_put() [function.ftp-put]: Can't open that file: Is a directory in ftp_upload_script.php on line 23 FTP upload has failed! I did try images/ for the destination but that was a invalid path it said. So I tried /images/ and the same for that. I just dont understand what its asking for. Wade ------------------------------------ Hello Wade, The server name or IP address should be used when you open the port connection along with the username and password. The remote file path is not needed or accepted when you are opening the connection. A relative path may work depending on the FTP config ie 'images/' or 'public_html/images/' or you may need to find the full path ie '/usr/www/useres/servername/account/home/public_html/images/'. A relative path cannot start with a (back)slash. The destination must also have the file name ie /www/home/public_html/mypic.jpg as this can be different to the source file name. Another problem you will see at times is sym links. The public_html may not actually be a folder but just a sym link to another folder like a shortcut in Windows. It is best to use the real file past. Although Apache may follow sym links for http, it may not follow them for ftp depending on the local config. This is especially true for shared servers. Apache treats folders and files in a similar way. Opening a read stream to a folder returns a directory listing and opening a read stream to file returns the data in the file. Hope tis helps. Rob.