...
| Code Block | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
  | ||||||||||
<?php
//get default Storage system
$storage = Phpfox::getLib('storage')->getStorage(); 
$path =  'PF.Base/file/new-file-api.txt';
// @param string $path     The path to the file.
// @param string $contents The file contents.
// @param array  $config   An optional configuration array.
// @return string full url of file
$fileUrl = $storage->getUrl($path);
?>
 | 
...
| Code Block | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
  | ||||||||||
<?php
$path =  'PF.Base/file/new-file-api.txt';
$content = 'file api content';
$config = ['visibility'=>'public'];
$storage = Phpfox::getLib('storage')->getStorage();
// @param string $path     The path to the file.
// @param string $contents The file contents.
// @param array  $config   An optional configuration array.
// @return bool True on success, false on failure.
$isSuccessful = $storage->put($path, $contents, $config);
?>
 | 
...
| Code Block | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
  | ||||||||||
<?php
$storage = Phpfox::getLib('storage')->getStorage();
$path =  'PF.Base/file/new-file-api.txt';
// Retrieves a read-stream for a path.
// @param string $path The path to the file.
// @throws FileNotFoundException
// @return resource|false The path resource or false on failure.
$stream$fileStream = $storage->readStream($path);
?>
 | 
...