UniSharp / laravel-filemanager

Media gallery with CKEditor, TinyMCE and Summernote support. Built on Laravel file system.
https://unisharp.github.io/laravel-filemanager/
MIT License
2.08k stars 721 forks source link

Unable to upload DOCX Word Files - You Cant Upload Files of this type #951

Open kinger251285 opened 4 years ago

kinger251285 commented 4 years ago

my lfm.php `<?php

/* -------------------------------------------------------------------------- Documentation for this config :
online => http://unisharp.github.io/laravel-filemanager/config
offline => vendor/unisharp/laravel-filemanager/docs/config.md

*/

return [ /* -------------------------------------------------------------------------- Routing
 */

'use_package_routes'       => true,

/*
|--------------------------------------------------------------------------
| Shared folder / Private folder
|--------------------------------------------------------------------------
|
| If both options are set to false, then shared folder will be activated.
|
 */

'allow_private_folder'     => true,

// Flexible way to customize client folders accessibility
// If you want to customize client folders, publish tag="lfm_handler"
// Then you can rewrite userField function in App\Handler\ConfigHandler class
// And set 'user_field' to App\Handler\ConfigHandler::class
// Ex: The private folder of user will be named as the user id.
'private_folder_name'      => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class,

'allow_shared_folder'      => true,

'shared_folder_name'       => 'shares',

/*
|--------------------------------------------------------------------------
| Folder Names
|--------------------------------------------------------------------------
 */

'folder_categories'        => [
    'file'  => [
        'folder_name'  => 'files',
        'startup_view' => 'grid',
        'max_size'     => 200000, // size in KB
        'valid_mime'   => [
            'image/jpeg',
            'image/pjpeg',
            'image/png',
            'image/gif',
            'image/svg+xml',
            'video/mp4',
            'video/mpeg',
            'application/pdf',                
            'application/vnd.ms-excel',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'application/docx',
        ],
    ],
    'image' => [
        'folder_name'  => 'photos',
        'startup_view' => 'list',
        'max_size'     => 200000, // size in KB
        'valid_mime'   => [
            'image/jpeg',
            'image/pjpeg',
            'image/png',
            'image/gif',
            'image/svg+xml',
            'application/pdf',
            'text/plain',
            'application/docx',
        ],
    ],
],

/*
|--------------------------------------------------------------------------
| Upload / Validation
|--------------------------------------------------------------------------
 */

'disk'                     => 'public',

'rename_file'              => false,

'alphanumeric_filename'    => false,

'alphanumeric_directory'   => false,

'should_validate_size'     => false,

'should_validate_mime'     => false,

// behavior on files with identical name
// setting it to true cause old file replace with new one
// setting it to false show `error-file-exist` error and stop upload
'over_write_on_duplicate'  => false,

'max_file_size'            => 200000,

/*
|--------------------------------------------------------------------------
| Thumbnail
|--------------------------------------------------------------------------
 */

// If true, image thumbnails would be created during upload
'should_create_thumbnails' => true,

'thumb_folder_name'        => 'thumbs',

// Create thumbnails automatically only for listed types.
'raster_mimetypes'         => [
    'image/jpeg',
    'image/pjpeg',
    'image/png',
],

'thumb_img_width'          => 200, // px

'thumb_img_height'         => 200, // px

/*
|--------------------------------------------------------------------------
| File Extension Information
|--------------------------------------------------------------------------
 */

'file_type_array'          => [
    'pdf'  => 'Adobe Acrobat',
    'doc'  => 'Microsoft Word',
    'docx' => 'Microsoft Word',
    'xls'  => 'Microsoft Excel',
    'xlsx' => 'Microsoft Excel',
    'zip'  => 'Archive',
    'gif'  => 'GIF Image',
    'jpg'  => 'JPEG Image',
    'jpeg' => 'JPEG Image',
    'png'  => 'PNG Image',
    'ppt'  => 'Microsoft PowerPoint',
    'pptx' => 'Microsoft PowerPoint',
],

/*
|--------------------------------------------------------------------------
| php.ini override
|--------------------------------------------------------------------------
|
| These values override your php.ini settings before uploading files
| Set these to false to ingnore and apply your php.ini settings
|
| Please note that the 'upload_max_filesize' & 'post_max_size'
| directives are not supported.
 */
'php_ini_overrides'        => [
    'memory_limit' => '256M',
],

]; ` Ive seen the other posts regarding this issue and none have fixed it.

I have tried adding the seperate array of mime_file_types and made no difference.

I have also tried removing the error identifier in the public/vendor/laravel-filemanager/js/dropzone-min.js file

kinger251285 commented 4 years ago

Any help appreciated?

Still unable to find a solution and no reason this shouldnt be working as far as i can see.

mafftor commented 4 years ago

attach please the file, I'll try to reproduce

kinger251285 commented 4 years ago

attach please the file, I'll try to reproduce

Hi Mafftor

Which file is it you want? The file to upload?

If so you can use any docx file and it isnt picked up as an option, if i change the dropdown to any file and then try to upload any docx i get the error as per the screen shot.

mafftor commented 4 years ago

I've tested and couldn't reproduce the bug Try to use my version of this package, It has a lot of advanced features https://github.com/mafftor/laravel-file-manager And write me later image

kinger251285 commented 4 years ago

I've tested and couldn't reproduce the bug Try to use my version of this package, It has a lot of advanced features https://github.com/mafftor/laravel-file-manager And write me later image

No difference, still not working

kinger251285 commented 4 years ago

UPDATE

I have managed to upload open data formats including text files and spreadsheet files as well as text files by using the correct mime types.

However i am still unable to upload word documents (.doc and .docx) or Excel Documents (.xls) files. Could this have something to do with server setup being ubuntu and not recognizing those mime types?

mafftor commented 4 years ago

You should test it out. Write me on telegram @mafftor and we could test it together if you don't know how

kinger251285 commented 4 years ago

Ive also tried removing the filemanager package and re-installing, checked my server mime types and all correct. Any other suggestions anyone?

disney1993 commented 4 years ago

I have the same problem exactly

IamMorgan commented 4 years ago

Faced the same problem, but was able to partially solve it by adding this to the lfm.php https://prnt.sc/tr3nvu files began to be loaded, before loading select "all files" https://prnt.sc/tr3p95

kinger251285 commented 4 years ago

Faced the same problem, but was able to partially solve it by adding this to the lfm.php https://prnt.sc/tr3nvu files began to be loaded, before loading select "all files" https://prnt.sc/tr3p95

IamMorgan - Thank you added the missing mime types from your first image and now it is working.

Was missing the below (Not sure if which one fixed it maybe the all caps Docx where i already had lower case?) but working nonetheless:

'image/vnd.microsoft.icon', 'image/x-icon', 'application/DOCX',

streamtw commented 3 years ago

Maybe we should add mime type of DOCX files into our document. Thanks for reporting this.