Main (PHP)
3rd Party Streams
Resources
Code Snippets
Affiliates
Archive_Tar::addString() Archive_Tar::addString() -- add a string in the archive
Description
This method adds the string
content in the archive like a file with full filename
filename .
If the archive does not exists it attempts to create it.
Return value
boolean - Returns TRUE on success, FALSE on failure.
Throws
Table 30-1. Possible PEAR_Error values
Error code Error message Reason Solution NULL
"Unable to open in write mode file name "
The file permissions for an existing file do not allow
writing or the file is locked.
Check permissions and possible competive programs using
the file.
NULL
"Unable to open file filename in binary read mode"
The file to add to the archive could not be read.
Check for typing mistakes in the function argument and file
permissions.
Note This function can not be called
statically.
Example Example 30-1. Add a string in a compressed archive
$tar_object = new Archive_Tar("tarname.tgz");
$content = "this file was generated from a string";
$tar_object->addString("data/readme.txt", $content);
// A file is created in the archive with name :
// data/readme.txt
Top Sponsor
Sponsors
Sponsors
Advertisting
Affiliates