> For the complete documentation index, see [llms.txt](https://helpdocs.quickadminpanel.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://helpdocs.quickadminpanel.com/create-panel/file-photo-upload-fields.md).

# File/Photo Upload Fields

In CRUDs Editor, we have two field types for files - called **File** and **Photo**. The difference is pretty small - **Photo** field has additional validation parameters for image size.

For uploading files, we're using a very popular package called [Laravel Medialibrary](https://github.com/spatie/laravel-medialibrary), you can view its [official documentation here](https://docs.spatie.be/laravel-medialibrary/v7/introduction).

&#x20;On the front-end, we're using [Dropzone Javascript library](https://www.dropzonejs.com/), here's how it looks together:

![](https://laraveldaily.com/wp-content/uploads/2019/03/file-photo-upload-form.png)

You can read our in-depth tutorial: [Multiple File Upload with Dropzone.js and Laravel MediaLibrary Package](https://laraveldaily.com/multiple-file-upload-with-dropzone-js-and-laravel-medialibrary-package/)

As per Laravel Medialibrary functionality, the files are stored by default in **storage/app/public** folder, dividing every file in its own subfolder with ID number:

![](https://laraveldaily.com/wp-content/uploads/2019/03/file-photo-upload-storage.png)

&#x20;By default, **storage/** internal folders are not available in the browser for public visitors, to change that - you need to run one important Artisan command:

```
php artisan storage:link
```

See more info in the official Laravel documentation: [The Public Disk](https://laravel.com/docs/master/filesystem#the-public-disk)

If you want to change the **location** of where files are stored, change your parameters in **config/filesystems.php** file:

```
'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
    ],

    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
        'url' => env('AWS_URL'),
    ],

],
```

In the database, filenames for all CRUDs are stores in one DB table **media** - this is how Laravel Medialibrary works.

![](https://laraveldaily.com/wp-content/uploads/2019/03/file-photo-media.png)

This table uses [Polymorphic Relations](https://www.youtube.com/watch?v=rx1DQBE01b0) to tie the media record to the CRUD Model it belongs to - see columns **model\_type** and **model\_id**.

## Troubleshooting

We can't ensure that all file uploads settings will be correct **on your web-server**. So if something doesn't work on your web-server after download, check out this guide on our blog: [Top 5 Questions/Answers About Spatie MediaLibrary](https://quickadminpanel.com/blog/top-5-questionsanswers-about-spatie-medialibrary/) - it answers these questions:

* Where are my files stored?&#x20;
* Why are my files not shown? 404 error?&#x20;
* How to generate/customize thumbnails?&#x20;
* How to query Media relationships in Eloquent?&#x20;
* Why artisan migrate doesn’t work with MediaLibrary?

Another article related to potential file/photo problem:&#x20;

{% embed url="<https://quickadminpanel.com/blog/why-its-important-to-change-app_url-in-laravel-env-file/>" %}

## Extra Customizations

If you want to save disk space, here's an article for you:

{% embed url="<https://quickadminpanel.com/blog/spatie-medialibrary-resize-original-uploaded-image/>" %}

If you want to change the **maximum file size** to upload, there will be a few places for that setting.

In **create.blade.php** and **edit.blade.php** of your CRUD, at the bottom there's a Dropzone setting **maxFilesize**, which by default is 2 MB:

```
@section('scripts')
<script>
    Dropzone.options.photoDropzone = {
    url: '{{ route('admin.products.storeMedia') }}',
    maxFilesize: 2, // MB
```

Also, you will need to update Laravel, PHP, and web-server settings on the back-end. For this, please read the detailed article:&#x20;

{% embed url="<https://laraveldaily.com/validate-max-file-size-in-laravel-php-and-web-server/>" %}
