SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 481 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

When we call the write() method we
must provide the path to the file that we intend to write and the data that we want to
write to the file. This example appends some data to the end of the file:
$lines[] = "\n"
if (!JFile::write($file, implode("\n", $lines)))
{
// handle failed file write
}
The last method that we will look at is the upload() method. This method is
intended to move files that have been uploaded. The method is similar to the
move() method except it handles the creation of the destination path and it sets the
permissions of the uploaded file.
Utilities and Useful Classes
[ 354 ]
This example takes the uploadFile array from the FILES request hash and copies it
to its new location:
$file = JRequest::getVar('uploadFile', '', 'FILES', 'array');
if (!JFile::upload($file, JPATH_COMPONENT.DS.'files'))
{
// handle failed upload
}
Archives
The joomla.filesystem.archive library provides us with two important things,
the static JArchive class and a number of archive adapters.


Pages:
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493