classic-o / nova-media-library

Media Library for admin panel "Laravel Nova"
MIT License
157 stars 66 forks source link

Error when upload pdf file #13

Closed YamShadow closed 5 years ago

YamShadow commented 5 years ago

Describe the bug I remove the maximum upload limit of files in the category 'docs', and I try to upload a pdf file of more than 2mo

To Reproduce Steps to reproduce the behavior:

  1. Go to 'media libraries'
  2. Click on 'upload files' and select my file
  3. See error

Screenshots Image of error

Additional context exemple of pdf

classic-o commented 5 years ago

Hi. Can You show me config file? And judging by the text of the error - this is an error in the laravel, not in my plugin. May be you removed link to storage or change permission to storage folder?

YamShadow commented 5 years ago

Hi, Thank you for your reply.

Here is my configuration file

return [

    /**
     * Here you may specify the default filesystem disk.
     * Available `public` or `s3`.
     *
     * @var string
     * @since 0.2.0
     */

    'disk'     => 's3' == env('FILESYSTEM_DRIVER') ? 's3' : 'public',

    /**
     * Will use to return base url of media file.
     *
     * @var string
     * @since 0.2.0
     */

    'url'       => 's3' == env('FILESYSTEM_DRIVER') ? env('AWS_URL', '') : '/storage',

    /**
     * Save all files in a separate folder.
     *
     * @example `media-library`
     *
     * @var string
     * @since 0.1.0
     */

    'folder'    => 'media',

    /**
     * Organize uploads into date based folders.
     * Available date characters: `Y`, `m`, `d` and symbols: `-`, `_`, `/`
     *
     * @example Y-m
     * @example Y/m
     * @example Y/m-d
     *
     * @var string|null
     * @since 0.2.0
     */

    'by_date'   => 'Y-m',

    /**
     * This option allow you to filter your files by types and extensions.
     * Format: Label => ['array of extensions'].
     *
     * @example ['*'] - allow you to save any file extensions to the specified type.
     *
     * @var array
     * @since 0.2.0
     */

    'types'     => [
        'Image'     => [ 'jpg', 'jpeg', 'png', 'gif', 'svg' ],
        'Docs'      => [ 'doc', 'xls', 'docx', 'xlsx', 'pdf' ],
        'Audio'     => [ 'mp3' ],
        'Video'     => [ 'mp4' ],
        #'Other'     => [ '*' ],
    ],

    /**
     * Maximum size of file uploads in bytes for each types.
     * Add `Label` => `max_size` in bytes for needed types to enable limitation for some types.
     * If you want to disable the limitation - leave empty array
     *
     * @var array
     * @since 0.2.0
     */

    'max_size'  => [
        'Image'     => 2097152,
    ],

    /**
     * The number of files that will be returned with each step.
     * The tool loads files from a folder not all at once.
     *
     * @var integer
     * @since 0.1.0
     */

    'step'      => 40,

    /**
     * Allow you to resize images by width\height. Using http://image.intervention.io library
     * Width and height can be integer or null. If one of them is null - will resize image proportionally
     * Supports image formats: http://image.intervention.io/getting_started/formats
     *
     * @var array
     * @since 0.2.0
     */

    'resize'    => [

        'image'     => 'Image',     # Label from types (Set `null` to disable resizing)

        'width'     => 1200,        # Maximum width in pixels

        'height'    => null,        # Maximum height in pixels

        'driver'    => 'gd',        # `gd` or `imagick` http://image.intervention.io/getting_started/configuration

        'quality'   => 80,          # 0 - 100

        'crop'      => true,        # Cropping image on the frontend

    ]
];

I tried to add a high number in the 'Docs' field on 'max_size' variable but that did not change anything.

All uploads work, both on my application from Laravel, and from Nova with your module (images, svg and pdf of less than 2mo). The permissions on the storage and the link are as well configured.

classic-o commented 5 years ago

Works well on my site http://prntscr.com/p1mvy3 I think problem with your server. Try to debug step by step.

YamShadow commented 5 years ago

It's works for me.

Beginner error ... My php.ini was bad setup on our new server.

Sorry for the inconvenience.