Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ipfs-images-php-client
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ipfs-images
ipfs-images-php-client
Commits
7f1cc6ae
Commit
7f1cc6ae
authored
Sep 12, 2017
by
Dmitry Nikulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve example in docs
parent
4f7de993
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
README.md
README.md
+20
-3
No files found.
README.md
View file @
7f1cc6ae
...
...
@@ -38,7 +38,8 @@ $ phpdoc -d src -t docs --visibility=public,protected --template=xml
$ vendor/bin/phpdocmd docs/structure.xml
```
## Пример использования:
## Пример использования
Создайте PHP-скрипт (например,
`index.php`
):
```
<?php
...
...
@@ -46,8 +47,24 @@ require('vendor/autoload.php');
use AttachmentsClient\AttachmentsClient;
$client = new AttachmentsClient('http://localhost:8100');
echo($client->uploadFromFile('composer.json'));
$client = new AttachmentsClient('http://img.azbyka.ru');
echo "Trying file upload:\n";
echo $client->uploadFromFile(__FILE__);
echo "\n\n";
$file = file_get_contents(__FILE__);
echo "Trying memory upload:\n";
$hash = $client->uploadFromMemory($file);
echo $hash . "\n\n";
$url = $client->getDownloadUrl($hash, basename(__FILE__));
echo "Download URL: $url\n";
?>
```
Этот скрипт загружает в хранилище сам себя двумя способами:
из файла потоком и из памяти, после чего выводит URL для скачивания.
Запустить его можно в командной строке:
```
$ php index.php
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment