In php, we can also directly operate ftp, and then use php to implement the same file upload and download functions as ftp. Here is a complete example.
1. LycFtpAbstract. class. php FTP base class
The Code is as follows:
Copy code
/* Author: mongoman
In PHP We also have the ability to directly operate FTP, and then use PHP to implement the same as FTP file upload and download the file function Oh, let me introduce a complete example.
First, LycFtpAbstract.class.php FTP base class
The code is as follows
Copy Code
String (remotepath.getbytes (encoding), "Iso-8859-1") transcoding.
* After testing, pass.
*///Ftpclientconfig conf = new Ftpclientconfig (FTPCLIENTCONFIG.SYST_NT);
Conf.setserverlanguagecode ("en");
Ftpclient.connect (URL, port);
If you use the default port, you can connect to the FTP server directly using the Ftp.connect (URL) ftpclient.login (username, password);//Login//settings file Transfer type is binary
Ftpclient.setfiletype (Ftpclient.binary_
One: Download the Commons-net-1.4.1.jar package, put it under LIB, and load it into the. classpath fileTwo: Write Tool class Ftputil.java as follows
Package common;
Import Java.io.File;
Import java.io.FileNotFoundException;
Import Java.io.FileOutputStream;
Import java.io.IOException;
Import Java.io.OutputStream;
Import java.net.SocketException;
Import java.util.Properties;
Import Org.apache.log4j.Logger;
Import Org.apache.commons.logging.Log;
Import Org.apache.commons.
;Leavecritsection (m_threadsync );Return ret;}
It can be seen that the role of sending this message is to allow ccontrolsocket to continue to call parsecommand () to process the next command.
Return to the original parsecommand (). If the command parameter is correct, check whether the command must be logged on before use (specified by bvalidbeforelogon). For example, the GET command must be logged on first
the SU command, the method to invoke is
Su Root–c ' echo
| PW Useradd
[-G] [GroupName] [-S] [Shelldir] [-H 0] '
After execution, the system will be asked to enter the administrator password, enter the password to execute this command as an administrator.
The main difficulty in implementing this step is how to invoke the above system commands through PHP to create a user, this example is implemented using PHP's Popen () function, which executes the instructio
Use PHP to implement online management code for Ftp users. The leader asked me to plan a web design competition and Flash creation competition. online registration and uploading of works are required. I have implemented this requirement through FreeBSD + Apache + PHP + Mysql + FTP. When the leaders want me to plan a web design competition and Flash creation compe
, the system requires you to enter the administrator password. Then, you can run the command as the administrator.
The main difficulty in implementing this step is how to use PHP to call the above system commands to create a user. In this example, the popen () function in PHP is used, this function executes commands to open the file. The syntax is int popen (string command, string mode). The opened file can only be one-way and can only be read or written, the corresponding "string mode" is 'R' o
called
Su root–c ' echo
After execution, the system will ask for an administrator password and enter the password to execute the command as an administrator.
The main difficulty in implementing this step is how to invoke the above system commands through PHP to create a user, this example is implemented using the Popen () function in PHP, which executes the instruction to open the file, the syntax is int popen (String command, String mode), its open file can only be one-way, can only read or
encapsulates the response of a file Transfer Protocol (FTP) server to a request.Stream data = Ftpresponse.getresponsestream (); Get a response stream from a response objectGets the stream that is used to read the body of the response from the serverThis program retrieves the stream that includes the response data sent from the FTP serverThe return value of the G
This article brings you the content is about PHP ftp upload and download the implementation code of the function, there is a certain reference value, there is a need for friends to refer to, I hope you have some help.
/** * Function: FTP operation class (copy, move, delete file/create directory) */class ftp{public $of
Python version
Achieve more and more complete functionality than the previous XXFTP
1, continue to support multi-user
2. Continue to support virtual directory
3. Added permission settings to support user root directory and map virtual directory
4. Increase the support limit the size of the user root directory or virtual directory space
Features of Xxftp
1, open source, cross-platform
2. Simple and easy to use
3. No database Required
4, the scalability of the ultra-strong
5. You can use XXFTP fo
is not the same, so only the data processing good, back to the front desk, Ajax judgment callback, if successful, use window.open (); Open a new window and pass the relevant parameters to the background controller, of course, preferably openwindow=window.open (); Assign it to close, and then give a intervalid =window.setinterval ("function name", 1000); This is the function named after opening a new window 1 seconds later, this function is used to display the exception thrown in the background,
In php, we can use ftp_connect functions to upload and download files. In fact, this is the same operation on the ftp client. Next I will introduce how to use php to implement it. In php, we can use ftp_connect functions to upload and download files. In fact, this is the same operation on the ftp client. Next I will introduce how to use php to implement it.
Script ec (2); script
The php
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.