Laravel-filemanager: Action failed, due to server error.

Created on 26 Feb 2017  路  17Comments  路  Source: UniSharp/laravel-filemanager

Hello, i have a problem. This message appears when opens.
my folder structure:

core/
   - app/
   - config/
   ...
 media/
 index.php

how can i how to set base_directory to 'media'. I have set the config like this

 'base_directory' => 'public',

    'images_folder_name' => '../../media/photos',
    'files_folder_name'  => '../../media/files',

    'shared_folder_name' => 'shares',
    'thumb_folder_name'  => 'thumbs',

thanks

WIP question

Most helpful comment

the problem is just faced me, and I solve it by giving the "public" folder or permissions and ownership by the following command in the terminal of the vps server of ubuntu:
" sudo chmod -R 775 /var/www/laravel/public "

copy and paste this command in the ssh terminal.
the problem was when I open the filemanager an Error message was just keeping popup. the message tells an error due to the server.
this is my Email: ahmad.[email protected] if anyone want help.

All 17 comments

i have same problems, in my case i'm using default config . i think this issue placed in traits helper lfm, where in lfmController construct function (isProcessingImages & files) always return true, this happen because in index view request method not work , ajax sending as null work dir. check in vendor resource filemanager at index.blade , and set value input name "type" to Images or Files, this work for me. this not good solution, but will help me while this issue solved. sorry for my bad english.

@nauvalazhar see here :

'base_directory' => 'public/media',

'images_folder_name' => 'photos',
'files_folder_name'  => 'files',

@g0110280 I have made the changes as you suggested but still have the same issue Action failed, due to server error here is my lfm.php

'base_directory' => 'public/images',

    'images_folder_name' => 'uploadedImages',
    'files_folder_name'  => 'files',

    'shared_folder_name' => 'shares',
    'thumb_folder_name'  => 'thumbs',

but noting fixed any other suggesting here please

When I try to browse server "Action failed, due to server error" message comes twice. Here is a screen shot
https://imgur.com/Bz3Kl4z
I have been trying to get a solution for several days but could not do anything.

@harunsir please post your console errors here.

@g0110280 i have done several ways, including your suggestions. but still didn't fix the problem and i was forced to go back on version ^1.6 and it worked fine.

of course , because in v 1,7 use lfm traits ,and this issue place on it.

Even in images it never accept underscore (_) in the image name it gives the same issue

Action failed, due to server error

@g0110280 have the same issue as @harunsir

http://fm.dev/admin/filemanager/folders?working_dir=&type=&_=1489250040011 
Failed to load resource: the server responded with a status of 500 (Internal Server Error)

http://fm.dev/admin/filemanager/errors?working_dir=&type=&_=1489250040012 
Failed to load resource: the server responded with a status of 500 (Internal Server Error)

I used the asset and url features of laravel and the problem was solved.

and
path_absolute : "{{ url('/') }}/"

I found a solution for a while, i don't know this is a great solution or not. But this has solved my problem, i try to move base_directory to storage and put a new route to access files in the storage directory.

Route::get('media/images/shares/{filename}', function ($filename) {
    $path = storage_path() . '/media/images/shares/' . $filename;
  if(!File::exists($path)) return view('errors.404');

  $file = File::get($path);
  $type = File::mimeType($path);

  $response = Response::make($file, 200);
  $response->header("Content-Type", $type);

  return $response;
});

i hope this helps

I found that @g0110280 from commit "remove all parameters passed by show() in LfmController" => b4e810f2a0135d4e8448ead9a9e083a36e3e293e (Feb 01) (view/index.blade.php), but /laravel-filemanager don't redirect to /laravel-filemanager?type=Images so "type" param is always "", and so that

if (!$this->isProcessingImages() && !$this->isProcessingFiles()) {
   throw new \Exception('unexpected type parameter');
  }

always throw Exception.

I don't know to fix it, because this is first time I use Laravel File Manager:
but you can pass "type" param from to LfmController@show like this

public function show()
    {
        return view('laravel-filemanager::index')->with([            
            'file_type'    => $this->currentLfmType(true),
        ]);
    }

and change view\index.blade.php
<input type='hidden' name='type' id='type' value="{{ request('type') }}">
to
<input type='hidden' name='type' id='type' value="{{ request('type') ?? $file_type }}">

or just change this only
<input type='hidden' name='type' id='type' value="{{ request('type') ?? 'Images' }}">

the problem is just faced me, and I solve it by giving the "public" folder or permissions and ownership by the following command in the terminal of the vps server of ubuntu:
" sudo chmod -R 775 /var/www/laravel/public "

copy and paste this command in the ssh terminal.
the problem was when I open the filemanager an Error message was just keeping popup. the message tells an error due to the server.
this is my Email: ahmad.[email protected] if anyone want help.

IT WORKS

i just face this issue ... i don't know what 丐ause it really but ..and that's what happen

1- i got the error and i spend hours to try to solve it
2- i ignore the first error (Action failed, due to server error)
3- i used the popup widow of filer manager (image properties) and create new folder
5- and then BOOOM it works just find ... and then error disappeared for ever

Please upgrade to v1.7.2. The message "Action failed, due to server error." occurs when ajax requests fail in any reason. So this issue is ambiguous. Exception messages will be displayed instead of "Action failed, due to server error." in v1.7.2.

The pop up shows 404
in laravel 5.7.28
/laravel-filemanager?field_name=mceu_84-inp&type=Images 404 (Not Found)
I got it
when I update the packages there is a new file lfm.php in config folder of the project, then I get another error
/resources/views/vendor/laravel-filemanager/index.blade.php)
Undefined variable: working_dir (0)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dzhangar1980 picture Dzhangar1980  路  4Comments

ikkosatrio picture ikkosatrio  路  4Comments

fahadhowlader picture fahadhowlader  路  5Comments

lunadiotic picture lunadiotic  路  3Comments

farshidahmadianpin picture farshidahmadianpin  路  3Comments