Skip to content

Commit 76b9647

Browse files
committed
docs: updated set up
1 parent bde5239 commit 76b9647

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

README.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,39 @@ PHP library for handling chunk uploads. Library contains helper methods for:
1010

1111
This library is compatible with HTML5 file upload library: https://github.com/flowjs/flow.js
1212

13-
Installation
13+
How to get started?
1414
--------------
15-
For easy installation you need to have Composer installed, if you don't please read installation document for Composer at https://getcomposer.org/download/.
15+
Download composer https://getcomposer.org/download/.
1616

17-
Clone this repository first:
17+
Clone repository:
1818
```
1919
git clone https://github.com/flowjs/flow-php-server.git
2020
```
21-
Then cd into the cloned directory:
21+
Go to the cloned directory:
2222
```
2323
cd flow-php-server
2424
```
2525
Use composer to download dependencies and autoload PHP classes.
2626
```
2727
composer install
2828
```
29-
This will create a vendor directory for you which contains an autoload.php file. Create a new php file:
30-
```
31-
touch upload.php
32-
```
33-
Edit upload.php and add these lines:
29+
This will create a vendor directory for you, which contains an autoload.php file.
30+
31+
Create a new php file named `upload.php`:
3432
```php
35-
namespace Flow;
3633
//Path to autoload.php from current location
37-
require_once './flow-php-server/vendor/autoload.php';
38-
```
39-
Note that you could also use ```use``` keyword to add each class inidividually into our current namespace. At this point you are ready to use flow. for more information about how to use it read Basic Usage section.
34+
require_once './vendor/autoload.php';
4035

41-
Basic Usage
42-
--------------
43-
```php
44-
if (\Flow\Basic::save('./final_file_destination', './chunks_temp_folder')) {
36+
$config = new \Flow\Config();
37+
$config->setTempDir('./chunks_temp_folder');
38+
$request = new \Flow\Request();
39+
if (\Flow\Basic::save('./' . $request->getIdentifier(), $config, $request)) {
4540
// file saved successfully and can be accessed at './final_file_destination'
4641
} else {
4742
// This is not a final chunk or request is invalid, continue to upload.
4843
}
4944
```
45+
5046
Make sure that `./chunks_temp_folder` path exists. All chunks will be save in this temporary folder.
5147

5248
If you are stuck with this example, please read this issue: [How to use the flow-php-server](https://github.com/flowjs/flow-php-server/issues/3#issuecomment-46979467)

0 commit comments

Comments
 (0)