Skip to content

Commit c360981

Browse files
committed
Merge remote-tracking branch 'origin/beta/v1.0'
2 parents e8cd12c + 2a0fb38 commit c360981

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<p align="center">
88
<strong>An all in one Laravel backend for <a href="https://pqina.nl/filepond/" target="_blank">FilePond</a></strong><br>
99
</p>
10+
1011
<p>
1112
We currently support the `process` and `revert` methods and are securing those via the Laravel encryption/decryption methods.
1213
</p>
@@ -27,38 +28,41 @@ If you need to edit the configuration, you can publish it with:
2728
php artisan vendor:publish --provider="Sopamo\LaravelFilepond\LaravelFilepondServiceProvider"
2829
```
2930

30-
Included in this repo is a Filepond upload controller which is where you should direct uploads to. Upon upload the controller will return the `$serverId` which Filepond will send via a hidden input field (same name as the img) to be used in your own controller to move the file from temporary storage to somewhere permanent using the `getPathFromServerId($request->input('image'))` function.
3131

3232
```php
3333
// Get the temporary path using the serverId returned by the upload function in `FilepondController.php`
3434
$filepond = app(\Sopamo\LaravelFilepond\Filepond::class);
35+
$disk = config('filepond.temporary_files_disk');
36+
3537
$path = $filepond->getPathFromServerId($serverId);
38+
$fullpath = Storage::disk($disk)->get($filePath);
39+
3640

3741
// Move the file from the temporary path to the final location
3842
$finalLocation = public_path('output.jpg');
39-
\File::move($path, $finalLocation);
43+
\File::move($fullpath, $finalLocation);
4044
```
4145

4246
#### External storage
4347

44-
You can use any [Laravel disk](https://laravel.com/docs/7.x/filesystem) as the storage for temporary files. If you use a different disk for temporary files and final location, you will need to copy the file from the temporary location to the new disk then delete the temporary file yourself.
48+
You can use any [Laravel disk](https://laravel.com/docs/7.x/filesystem) as the storage for temporary files. If you use a different disk for the temporary files and the final location, you will need to copy the file from the temporary location to the new disk then delete the temporary file yourself.
4549

4650
If you are using the default `local` disk, make sure the /storage/app/filepond directory exists in your project and is writable.
4751

48-
### Filepond setup
52+
### Filepond client setup
4953

50-
Set at least the following Filepond configuration:
54+
This is the minimum Filepond JS configuration you need to set after installing laravel-filepond.
5155

5256
```javascript
5357
FilePond.setOptions({
5458
server: {
5559
url: '/filepond/api',
5660
process: '/process',
5761
revert: '/process',
62+
patch: "?patch=",
5863
headers: {
5964
'X-CSRF-TOKEN': '{{ csrf_token() }}'
6065
}
6166
}
6267
});
6368
```
64-

0 commit comments

Comments
 (0)