Ask Warning:ftp_put () [Function.ftp-put]: Opening BINARY mode data connection
Source: Internet
Author: User
Ask Warning:ftp_put () [Function.ftp-put]: Opening BINARY mode data connection
Excuse me, what is the cause of the wrong question?
------Solution--------------------
This is the example in the PHP manual and your answer.
Here's a quick function, the figures out, the correct mode to use based on a file ' s extension.
function Get_ftp_mode ($file)
{
$path _parts = PathInfo ($file);
if (!isset ($path _parts[' extension ')) return ftp_binary;
Switch (strtolower ($path _parts[' extension ')) {
Case ' AM ': Case ' ASP ': Case ' bat ': Case ' C ': Case ' cfm ': Case ' CGI ': Case ' conf ':
Case ' CPP ': Case ' CSS ': Case ' DHTML ': Case ' diz ': Case ' h ': Case ' hpp ': Case ' htm ':
Case ' HTML ': Case ' in ': Case ' inc ': Case ' JS ': Case ' M4 ': Case ' mak ': Case ' NFS ':
Case ' NSI ': Case ' pas ': case ' patch ': Case ' php ': Case ' php3 ': Case ' php4 ': Case ' php5 ':
Case ' phtml ': case ' pl ': Case ' po ': Case ' py ': Case ' qmail ': Case ' sh ': Case ' shtml ':
Case ' the ' SQL ': Case ': "The Case ' TPL ': Case ' txt ': Case ' vbs ': Case ' xml ': Case ' XRC ':
return ftp_ascii;
}
return ftp_binary;
}
Sample usage
Ftp_get ($conn _id, $local _file, $server _file, Get_ftp_mode ($server _file));
?>
------Solution--------------------
Did you use binary mode?
------Solution--------------------
Servers are typically placed behind firewalls, so the FTP client program needs to turn on passive mode if it needs to go through the firewall, otherwise the execution of any FTP command will not respond until a fatal error "Maximum execution time timeout" occurs, causing the program to terminate running ...
Workaround, refer to: http://www.bacysoft.cn/thread-10-1-1.html
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service