Skip to content

Commit ed3cd61

Browse files
authored
New features merged from version 12 ⏫ (#77)
* Docker dev environment isolated 🐳 * New features merged from version 12 ⏫ * Changelog updated 📄
1 parent 47df20c commit ed3cd61

File tree

4 files changed

+42
-15
lines changed

4 files changed

+42
-15
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to `laravel-filepond` will be documented in this file.
44

5+
## 10.1.2 - 2025-05-08
6+
7+
- Mimetype added in fileinfo response. ✨
8+
- Fixed overriding the disk default visibility. 🐛
9+
510
## 10.0.2 - 2024-07-30
611

712
- Fixed large file processing in third party storage 🐛.

README.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,25 @@ Support the development with a :star: to let others know it worked for you.
2626

2727
- Thanks [ludoguenet](https://github.com/ludoguenet) for featuring my package in - [Créer un système de Drag'n Drop avec Laravel Filepond](https://www.youtube.com/watch?v=IQ3fEseDck8) (in French).
2828

29+
## Documentation
30+
31+
See the corresponding branch for the documentation.
32+
33+
|Version|Branch|
34+
|:-:|:-:|
35+
|Laravel 12|[12.x branch](../../tree/12.x/README.md)|
36+
|Laravel 11|[11.x branch](../../tree/11.x/README.md)|
37+
|Laravel 10|[10.x branch](../../tree/10.x/README.md)|
38+
|Laravel 9|[9.x branch](../../tree/9.x/README.md)|
39+
|Laravel 8|[8.x branch](../../tree/8.x/README.md)|
40+
|Laravel 7|[7.x branch](../../tree/7.x/README.md)|
41+
2942
## Installation
3043

3144
Laravel 10 users install with.
3245

3346
```bash
34-
composer require rahulhaque/laravel-filepond:"^10"
47+
composer require rahulhaque/laravel-filepond:"^10.0"
3548
```
3649

3750
Publish the configuration and migration files.
@@ -131,6 +144,7 @@ class UserAvatarController extends Controller
131144
// "dirname" => "avatars",
132145
// "basename" => "avatar-1.png",
133146
// "extension" => "png",
147+
// "mimetype" => "image/png",
134148
// "filename" => "avatar-1",
135149
// "location" => "avatars/avatar-1.png",
136150
// "url" => "http://localhost/storage/avatars/avatar-1.png",
@@ -148,6 +162,7 @@ class UserAvatarController extends Controller
148162
// "dirname" => "galleries",
149163
// "basename" => "gallery-1-1.png",
150164
// "extension" => "png",
165+
// "mimetype" => "image/png",
151166
// "filename" => "gallery-1-1",
152167
// "location" => "galleries/gallery-1-1.png",
153168
// "url" => "http://localhost/storage/galleries/gallery-1-1.png",
@@ -157,6 +172,7 @@ class UserAvatarController extends Controller
157172
// "dirname" => "galleries",
158173
// "basename" => "gallery-1-2.png",
159174
// "extension" => "png",
175+
// "mimetype" => "image/png",
160176
// "filename" => "gallery-1-2",
161177
// "location" => "galleries/gallery-1-2.png",
162178
// "url" => "http://localhost/storage/galleries/gallery-1-2.png",
@@ -166,6 +182,7 @@ class UserAvatarController extends Controller
166182
// "dirname" => "galleries",
167183
// "basename" => "gallery-1-3.png",
168184
// "extension" => "png",
185+
// "mimetype" => "image/png",
169186
// "filename" => "gallery-1-3",
170187
// "location" => "galleries/gallery-1-3.png",
171188
// "url" => "http://localhost/storage/galleries/gallery-1-3.png",
@@ -177,21 +194,23 @@ class UserAvatarController extends Controller
177194

178195
This is the quickest way to get started. This package has already implemented all the classes and controllers for you. Next we will discuss about all the nitty gritty stuffs available.
179196

180-
> **Important:** If you have Laravel debugbar installed, make sure to add `filepond*` in the `except` array of the `./config/debugbar.php` to ignore appending debugbar information.
197+
> [!IMPORTANT]
198+
> If you have Laravel debugbar installed, make sure to add `filepond*` in the `except` array of the `./config/debugbar.php` to ignore appending debugbar information.
181199
182200
## Configuration
183201

184202
First have a look at the `./config/filepond.php` to know about all the options available out of the box. Some important ones mentioned below.
185203

186204
#### Permanent Storage
187205

188-
This package uses Laravel's public filesystem driver for permanent file storage by default. Change the `disk` option to anything you prefer for permanent storage. Hold up! But I am using different disks for different uploads. Don't worry. You will be able to change the disk name on the fly with [copyTo()](https://github.com/rahulhaque/laravel-filepond#copyto) and [moveTo()](https://github.com/rahulhaque/laravel-filepond#moveto) methods.
206+
This package uses Laravel's public filesystem driver for permanent file storage by default. Change the `disk` option to anything you prefer for permanent storage. Hold up! But I am using different disks for different uploads? Don't worry. You will be able to change the disk name on the fly with [copyTo()](https://github.com/rahulhaque/laravel-filepond#copyto) and [moveTo()](https://github.com/rahulhaque/laravel-filepond#moveto) methods.
189207

190208
#### Temporary Storage
191209

192-
This package uses Laravel's local filesystem driver for temporary file storage by default. Change the `temp_disk` and `temp_folder` name to points towards directory for temporary file storage.
210+
This package uses Laravel's `local` filesystem driver for temporary file storage by default. Change the `temp_disk` and `temp_folder` name to points towards directory for temporary file storage.
193211

194-
> **Note:** Setting temporary file storage to third party will upload the files directly to cloud. On the other hand, you will lose the ability to use controller level validation because the files will not be available in your application server.
212+
> [!NOTE]
213+
> Setting temporary file storage to third party will upload the files directly to cloud. On the other hand, you will lose the ability to use controller level validation because the files will not be available in your application server.
195214
196215
#### Validation Rules
197216

@@ -213,7 +232,8 @@ This package includes a `php artisan filepond:clear` command to clean up the exp
213232

214233
This command takes a `--all` option which will truncate the `Filepond` model and delete everything inside the temporary storage regardless they are expired or not. This is useful when you lost track of your uploaded files and want to start clean.
215234

216-
> If you see your files are not deleted even after everything is set up correctly, then its probably the directory permission issue. Try setting the permission of filepond's temporary directory to 775 with `sudo chmod -R 775 ./storage/app/filepond/`. And run `php artisan filepond:clear --all` for a clean start (optional). For third party storage like - amazon s3, make sure you have the correct policy set.
235+
> [!NOTE]
236+
> If you see your files are not deleted even after everything is set up correctly, then its probably directory permission issue. Try setting the permission of filepond's temporary directory to 775 with `sudo chmod -R 775 ./storage/app/filepond/`. And run `php artisan filepond:clear --all` for a clean start (optional). For third party storage like - amazon s3, make sure you have the correct policy set.
217237
218238
### Methods
219239

@@ -225,7 +245,8 @@ This command takes a `--all` option which will truncate the `Filepond` model and
225245

226246
Use `Rule::filepond($rules)` inside Request class or directly in controller or in custom Validator to validate your filepond fields. See the example.
227247

228-
> **Note:** This method will not work when third party storage is set as your temporary storage. The files are uploaded directly to your third party storage and not available locally for any further modification. Calling this method in such condition will throw error that the file is not found.
248+
> [!NOTE]
249+
> This method will not work when third party storage is set as your temporary storage. The files are uploaded directly to your third party storage and not available locally for any further modification. Calling this method in such condition will throw error that the file is not found.
229250
230251
#### copyTo()
231252

@@ -249,7 +270,8 @@ If you need more granular approach and know the ins and outs of this package, yo
249270

250271
Processing the file object manually will not update the associated `Filepond` model which is used to keep track of the uploaded files. However the expired files will be cleaned up as usual by the scheduled command. It is recommended that you either call the [delete()](#delete) method or update the underlying model by calling [getModel()](#getModel) method after the processing is done.
251272

252-
> **Note:** This method is not available when third party storage is set as your temporary storage. The files are uploaded directly to your third party storage and not available locally for any further modification. Calling this method in such condition will throw error that the file is not found.
273+
> [!NOTE]
274+
> This method is not available when third party storage is set as your temporary storage. The files are uploaded directly to your third party storage and not available locally for any further modification. Calling this method in such condition will throw error that the file is not found.
253275
254276
#### getModel()
255277

@@ -283,7 +305,7 @@ User::find(1)->fileponds;
283305

284306
## Development
285307

286-
First clone the repo and `cd` into the directory. Build development environment with docker.
308+
First clone the repo and `cd` into the directory. Switch to `10.x-dev` branch. Build and start development environment with docker.
287309

288310
```bash
289311
# Build the development image
@@ -293,7 +315,7 @@ docker compose build
293315
docker compose up -d
294316

295317
# Drop to development shell
296-
docker compose exec laravel-filepond bash
318+
docker compose exec laravel-filepond-10 bash
297319

298320
# Install dependencies
299321
composer install
@@ -312,7 +334,7 @@ docker compose stop
312334
docker compose down -v
313335

314336
# Also remove the development image if necessary
315-
docker image rm laravel-filepond-development
337+
docker image rm laravel-filepond-10-development
316338
```
317339

318340
## Testing

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
version: '3'
21
services:
3-
laravel-filepond:
4-
image: laravel-filepond-development:10.x
2+
laravel-filepond-10:
3+
image: laravel-filepond-10-development:10.x
54
build:
65
context: ./docker/8.1
76
dockerfile: Dockerfile

src/Filepond.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,15 @@ private function putFile(FilepondModel $filepond, string $path, string $disk, st
187187
Storage::disk($permanentDisk)->writeStream(
188188
$pathInfo['dirname'].DIRECTORY_SEPARATOR.$pathInfo['filename'].'.'.$filepond->extension,
189189
Storage::disk($this->getTempDisk())->readStream($filepond->filepath),
190-
['visibility' => $visibility],
190+
$visibility !== '' ? ['visibility' => $visibility] : [],
191191
);
192192

193193
return [
194194
'id' => $filepond->id,
195195
'dirname' => dirname($path.'.'.$filepond->extension),
196196
'basename' => basename($path.'.'.$filepond->extension),
197197
'extension' => $filepond->extension,
198+
'mimetype' => $filepond->mimetypes,
198199
'filename' => basename($path.'.'.$filepond->extension, '.'.$filepond->extension),
199200
'location' => $path.'.'.$filepond->extension,
200201
'url' => Storage::disk($permanentDisk)->url($path.'.'.$filepond->extension),

0 commit comments

Comments
 (0)