List Info

Thread: ftp script




ftp script
country flaguser name
United States
2008-03-24 18:36:16

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

__._,_.___
.

__,_._,___
Re: ftp script
country flaguser name
Australia
2008-03-24 19:13:32

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

__._,_.___
.

__,_._,___
RE: ftp script
country flaguser name
United States
2008-03-25 23:57:32


$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!

Hey Wade, I think that the $destination_file needs to be the actual
filename.

$destination_file = 'MY_FILE.txt';

It's the remote FILE not the remote directory:

bool ftp_put ( resource $ftp_stream , string $remote_file , string
$local_file , int $mode [, int $startpos ] )

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Re: ftp script
country flaguser name
United States
2008-03-26 07:13:00

Lenny Davila wrote:
> Hey Wade, I think that the $destination_file needs to be the actual
> filename.
>
> $destination_file = 'MY_FILE.txt';

03262008 0712 GMT-6

I found a tutorial on another site that said just that. I got it
working. I was just reading it wrong.

Thanks

Wade

__._,_.___
.

__,_._,___
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )