
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
PHP FTP context options
Introduction
Context options for http:// and https:// transports are listed below −
overwrite | Allow overwriting of already existing files on remote server while uploading only. |
resume_pos | File offset at which to begin transfer. Applies for downloading only.Defaults to 0 (Beginning of File). |
proxy | Proxy FTP request via http proxy server. Applies to file read operations only. Ex −tcp://squid.example.com:8000. |
This example shows how to allow fopen() to overwrite a file on an FTP site.
Example
<?php $ftp_path = 'ftp://username:password@example.com/example.txt'; $stream_options = array('ftp' => array('overwrite' => true)); $stream_context = stream_context_create($stream_options); $fh = fopen($ftp_path, 'w', 0, $stream_context); fputs($fh, 'Hello World'); fclose($fh); ?>
- Related Articles
- PHP HTTP context options
- PHP MongoDB context options
- PHP Phar context options
- PHP Socket context options
- PHP SSL context options
- PHP Zip context options
- CURL context options in PHP
- PHP ftp://
- PHP Context Parameters
- What is FTP?
- What is the FTP?
- FTP protocol client in Python
- Difference between TELNET and FTP
- Difference between FTP and TFTP
- What are the FTP Connections?

Advertisements