Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17244 программиста и 1834 робота. Сейчас ищут 1692 программиста ...

Net_FTP::get()

Вернуться к: Net_FTP

Net_FTP::get()

Net_FTP::get() – download a file to the computer your script runs on.

Synopsis

require_once 'Net/FTP.php';

mixed Net_FTP::get ( string $remote_file , string $local_file , bool $overwrite = false , int $mode = null )

This downloads a file from the FTP server to the computer your script runs on.

Parameter

  • string $remote_file - The file you'd like to download. This could either be an absolute or relative path to a file (not a directory! see: Net_FTP::getRecursive()).

  • string $local_file - The destination you'd like to download the file to (including filename, not directory!). You can specify this with either an absolute path or a path relative to the scripts directory. (Beware: The script directory is determined by the called script, if you use includes!)

  • bool $overwrite = false - Whether to overwrite the local file if it exists, or not. if not set the file will not be overwritten.

  • int $mode = null - This has to be one of the constants FTP_ASCII or FTP_BINARY. if not specified, the class will try to determine the mode from the file extension (from extensions.ini) or fall back to the standard transfer mode (attribute).

Return value

mixed - true on success, otherwise PEAR::Error.

Throws

Several errors may be returned by get. The errornumber is unspecific (until now) and will not tell you anything about the errormessage. Possible errors are:

Possible PEAR_Error values
Error message Description Solution
Local file '$local_file' exists and may not be overwriten. The local file you specified exists and you did not specify to overwrite it. Set parameter $overwrite = true.
Local file '$file' is not writeable. Can not overwrite. You specified to overwrite the localfile. This did not work. Maybe you don't have the permission to overwrite the file. Check the filepermissions.
File '$remote_file' could not be downloaded to '$local_file'. The download of the remote file failed. This may have several reasons: Maybe the remote file does not exist or the local directory you wanted to download to does not exist or is not writeable.

Note

This function can not be called statically.

Example

Using get()

<?php
     
    var_dump
($test->get('foo/bar.zip''/tmp/downloaded.zip'trueFTP_BINARY));
    
?>


Вернуться к: Net_FTP

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware