PHP WebSocket2 Library
PHP5 Library for browsing web
HttpFileAttachment Class Reference

HTTP file attachment class. More...

Inheritance diagram for HttpFileAttachment:
HttpAttachment

Public Member Functions

 __construct ($filename, $file_path)
 Constructor. More...
 
 setPartSize ($part_size)
 Sets size of part of file data in bytes that will be sent to socket at once. More...
 
 getPartSize ()
 Returns size of part of file data in bytes that will be sent to socket at once. More...
 
 writeTo (HttpSocket $socket)
 Writes raw attachment data to HttpSocket $socket. More...
 
 getSize ()
 
- Public Member Functions inherited from HttpAttachment
 __construct ($filename)
 Constructor. More...
 
 setFilename ($filename)
 Sets attachment file name. More...
 
 setContentType ($content_type)
 Sets attachment content-type. More...
 
 getFilename ()
 Returns attachment file name. More...
 
 getContentType ()
 Returns attachment content-type. More...
 
 writeTo (HttpSocket $socket)
 Writes raw attachment data to HttpSocket $socket. More...
 
 getSize ()
 Returns attachment size in bytes. More...
 

Detailed Description

HTTP file attachment class.

Examples:
http_file_upload.php.

Constructor & Destructor Documentation

__construct (   $filename,
  $file_path 
)

Constructor.

Parameters
string$filenameAttachment file name (this will be sent over HTTP)
string$file_pathAttachment file path
Exceptions
WebRequestExceptionif an error occured when requesting file size

Member Function Documentation

getPartSize ( )

Returns size of part of file data in bytes that will be sent to socket at once.

Default value is 2048 bytes.

Return values
intSize of part of file data in bytes that will be sent to socket at once
setPartSize (   $part_size)

Sets size of part of file data in bytes that will be sent to socket at once.

Default value is 2048 bytes.

Parameters
int$part_sizeSize of part of file data in bytes that will be sent to socket at once
writeTo ( HttpSocket  $socket)

Writes raw attachment data to HttpSocket $socket.

Parameters
HttpSocket$socketSocket to send data to
Exceptions
WebRequestExceptionif an error occured when opening or reading file

The documentation for this class was generated from the following file: