Tag Archives: file

stream_copy_to_stream()

int stream_copy_to_stream ( resource source, resource dest [, int maxlength [, int offset]] )

Makes a copy of up to maxlength bytes of data from the current position (or from the offset position, if specified) in source to dest. If maxlength is not specified, all remaining content in source will be copied.

stream_copy_to_stream($source_file, $destination_file);

Share

File Wrappers

o Provide information on protocols and encodings

 can be any file wrapper

 allows for two pipelines at most – for reading & writing

o Prefix in front of a file path

file:// php://
http:// compress.zlib://
https:// compress.bzip2://
ftp:// ftps://

o Custom Wrappers

stream_wrapper_register(protocol, classname)

Registers a protocol; implementation is part of the class.

 the class implements standard functionality like reading, writing, or changing the file position
 php_user_filter is a predefined class in php and is used in conjunction with user-defined filters

Share