PHP ftp://


Introduction

Both ftp:// and  ftps:// wrappers allow read access to URLs with ftp (and ftps) protocol. New file can also be created using these wrappers. If passive mode ftp support is not possible in the server, connection will fail.

Simultaneous read-write operations are not permitted with streams using ftp protocol. If it is required to overwrite existing file, it may be done by specifying overwrite option in context options.

The php.ini file has from setting which specifies email ID to be used for unauthenticated FTP connection.If it is set, it is used as anonymous FTP password. It is also possible to have ftp access with the help of FTP extension.

The ftps:// is supported only if openssl extension is enabled in php.ini. If server doesn't support SSL, the connection reverts to unencrypted mode.

Usage

ftp://example.com/pub/test.txt
ftps://user:password@example.com/pub/test.txt

Updated on: 22-Sep-2020

218 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements