barryvdh / laravel-elfinder

elFinder bundle for Laravel
739 stars 171 forks source link

Error - Undefined index: url #139

Open zawaruddin opened 8 years ago

zawaruddin commented 8 years ago

i have error after upload file, returning popup message "Undefined index: url", "Undefined index: hash"

also thumbnail doesn't display ....

my laravel project in "_laraza" folder, and my public in "laraza". can you help me?

this's my config/elfinder.php

return array(
    'dir' => ['files'],
    'disks' => [
      'public' => ['URL' => asset('public'), 'alias' => 'My Documents' ]
    ],

    'route' => [
        'prefix' => 'elfinder',
        'middleware' => ['web', 'auth'], 
    ],

    'access' => 'Barryvdh\Elfinder\Elfinder::checkAccess',

    'roots' => null,

    'options' => array(),

    'root_options' => array(
        'uploadAllow' => ['image/gif', 'image/jpeg', 'image/pjpeg', 'image/png'],
        'uploadDeny'    => array('all'),
        'uploadMaxSize' => '3M',
        'tmbPath' => str_replace(env('REAL_SYSTEM_PATH'), env('REAL_PUBLIC_PATH'), public_path()).'/.tmb',
        'tmbUrl' => asset('public/.tmb'),
    ),
);

and this's my config/filesystem.php for public disk

'public' => [
            'driver' => 'local',
            'root' => str_replace(env('REAL_SYSTEM_PATH'), env('REAL_PUBLIC_PATH'), public_path()),
            'url' => asset('public'),
            'visibility' => 'public',
        ],

// .env config
//REAL_PUBLIC_PATH = laraza
//REAL_SYSTEM_PATH = _laraza
barryvdh commented 8 years ago

Are you on the last version? Did you publish the latest files?

zawaruddin commented 8 years ago

i think yea, i pull it last week. can you explain me about "publish the latest files" ? i don't get it.

barryvdh commented 8 years ago

Did you run php artisan elfinder:publish ?

barryvdh commented 8 years ago

Also, try the dev-version, I've made some changes to the driver: "^0.3@dev"

zawaruddin commented 8 years ago

yes, i run php artisan elfinder:publish and try dev-version in other project with same config. But still did'nt show the thumbnail and show message "Undefined index: url" after upload files...

is something wrong with my configuration?

zawaruddin commented 8 years ago

there's 'dir' index in your config/elfinder.php 'dir' => ['files'],

the value can be multiple array value or single value?

zawaruddin commented 8 years ago

and now i get solution how to fix it....

i don't know, but in your config/elfinder.php, while i use Filesystem disks

'dir' => ['files'],
'disks' => [
      'public' => ['URL' => asset('public/files'),
      'alias' => 'My Documents' ]
    ],

it always return popup message "Undefined index: url" after upload file and thumbnail dont show.

But if i use dir

'dir' => [
             [
              'URL' => 'public/files',
              'path' => str_replace(env('REAL_SYSTEM_PATH'), env('REAL_PUBLIC_PATH'), public_path()).'/files' 
             ]
         ],
'disks' => [],

and editing showConnector function in ElfinderConnector.php

foreach ($dirs as $dir) {
                $roots[] = [
                    'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
                    'path' => public_path($dir), // path to files (REQUIRED)
                    'URL' => url($dir), // URL to files (REQUIRED)
                    'accessControl' => $this->app->config->get('elfinder.access') // filter callback (OPTIONAL)
                ];
            }

became

foreach ($dirs as $dir) {
                $roots[] = [
                    'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)

                    // let people define the "public path" in config/elfinder.php
                    'path' => $dir['path'], // path to files (REQUIRED)
                    'URL' => url($dir['URL']), // URL to files (REQUIRED)
                    'accessControl' => $this->app->config->get('elfinder.access') // filter callback (OPTIONAL)
                ];
            }

it's work, no popup message, and it's display the thumbnail...

dbr0 commented 8 years ago

Thanks for your info @zawaruddin

I'm having the same problem but I'm using Amazon s3 and if I move driver, path and url from disks to dir I can't access the disk (volume) anymore.

Also it seems to me that the 'URL' parameter is not handled properly when using disks or I'm passing the wrong value because even if I remove it I still get the same error.