...
- Local filesystem
- Amazon Simple Storage System (S3)
- Digital Ocean Space
- FTP storage file system via FTP connect
- SFTP server via SSH connect
- S3 Compatible storage system (see https://help.servmask.com/knowledgebase/list-of-s3-compatible-storage-providers/List of S3-compatible storage providers )
Below are some sample codes to manipulate files with storage systems on phpFox site:
...
Code Block |
---|
language | php |
---|
theme | RDark |
---|
borderStyle | solid |
---|
linenumbers | true |
---|
collapse | true |
---|
|
<?php
// Get storage object associate with storageId = 1.
$storage = Phpfox::getLib('storage')->getStorage(1);
// Get default storage
$storage = Phpfox::getLib('storage')->getStorage();
// Get default storage Id
$defaultStorageId = Phpfox::getLib('storage')->getStorageId(); |
...
Code Block |
---|
language | php |
---|
theme | RDark |
---|
borderStyle | solid |
---|
linenumbers | true |
---|
collapse | false |
---|
|
<?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 |
---|
language | php |
---|
theme | RDark |
---|
borderStyle | solid |
---|
linenumbers | true |
---|
collapse | false |
---|
|
<?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 |
---|
language | php |
---|
theme | RDark |
---|
borderStyle | solid |
---|
linenumbers | true |
---|
collapse | false |
---|
|
<?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);
?>
|
...