Skip to content

Commit a3bf45b

Browse files
author
Martin Kluska
committed
updated readme
1 parent 7cee8b3 commit a3bf45b

File tree

1 file changed

+51
-4
lines changed

1 file changed

+51
-4
lines changed

readme.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@ ___Project in progress___
44

55
## Instalation
66

7-
composer require pion/laravel-chunk-upload
7+
**Install via composer**
8+
9+
```
10+
composer require pion/laravel-chunk-upload
11+
```
12+
13+
**Add the service provider**
14+
15+
```php
16+
\Pion\Laravel\ChunkUpload\Providers\ChunkUploadServiceProvider::class
17+
```
18+
19+
___Optional___
20+
21+
**Publish the config**
22+
23+
Run the publish command to copy the translations (Laravel 5.2 and above)
24+
25+
```
26+
php artisan publish --provider="Pion\Laravel\ChunkUpload\Providers\ChunkUploadServiceProvider"
27+
```
28+
29+
Run the publish command to copy the translations (Laravel 5.1)
30+
31+
```
32+
php artisan vendor:publish --provider="Pion\Laravel\ChunkUpload\Providers\ChunkUploadServiceProvider"
33+
```
834

935
## Usage
1036

@@ -20,6 +46,8 @@ In your own controller create the `FileReceiver`, more in example.
2046
uses **chunked writing** aswell to minimize the memory footprint
2147
* **Storing per Laravel Session to prevent overwrite**
2248
all TMP files are stored with session token
49+
* [**Clear command and schedule**](#uploads:clear)
50+
the package registers the shedule command (uploads:clear) that will clear all unfinished chunk uploads
2351

2452
## Basic documentation
2553

@@ -123,6 +151,19 @@ Add a route to your controller
123151
Route::post('upload', 'UploadController@upload');
124152
```
125153

154+
### Commands
155+
156+
#### uploads:clear
157+
Clears old chunks from the chunks folder, uses the config to detect which files can be deleted via the last edit time `clear.timestamp`.
158+
159+
The scheduler can be disabled by a config `clear.schedule.enabled` or the cron time can be changed in `clear.schedule.cron` (don't forget to setup your scheduler in the cron)
160+
161+
##### Command usage
162+
163+
````
164+
php artisan uploads:clear
165+
````
166+
126167
## Providers/Handlers
127168

128169
### ContentRangeUploadHandler
@@ -136,15 +177,21 @@ Route::post('upload', 'UploadController@upload');
136177
* `getBytesEnd()` - returns the ending bytes for current request
137178
* `getBytesTotal()` - returns the total bytes for the file
138179

180+
## Since v0.2.0
181+
182+
The package supports the Laravel Filesystem. Becouse of this, the storage must be withing the app folder `storage/app/` or custom drive (only local) - can be set in the config `storage.disk`.
183+
184+
The cloud drive is not supported becouse of the chunked write (probably could be changed to use a stream) and the resulting object - `UploadedFile` that supports only full path.
139185

140186
## Todo
141187

142188
- [ ] add more providers (like pbupload)
143189
- [ ] add facade for a quick usage with callback and custom response based on the handler
144-
- [ ] cron to delete uncompleted files
145-
- [x] file per session (to support multiple)
146-
- [ ] add a config with custom storage location
190+
- [x] cron to delete uncompleted files `since v0.2.0`
191+
- [x] file per session (to support multiple) `since v0.1.1`
192+
- [x] add a config with custom storage location `since v0.2.0`
147193
- [ ] add an example project
194+
- [ ] add support to different drive than a local drive
148195

149196
## Contribution
150197
Are welcome. To add a new provider, just add a new Handler (which extends AbstractHandler), implement the chunk

0 commit comments

Comments
 (0)