Placid
Placid

Reputation: 1448

Laravel Unisharp File Manager Incorrect URL after uploading images

I am using Laravel 5.2 and UniSharp File Manager version 1.6.

I have setup everything as per docs. I am trying to integrate the file manager independenty. I am using all default configs in config/lfm.php except I have set "allow_multi_user" to false.

The problem is whenever I am uploading an image and selecting it using the file manager, the url of the uploaded/selected file is showing wrong url like this:

http://localhost:8000/photosshares/57ac916bada5b.jpg

whereas, the url should be:

http://localhost:8000/photos/shares/57ac916bada5b.jpg

The url is missing a front slash in it. How to solve this problem?

Upvotes: 2

Views: 3346

Answers (3)

This also worked for me by replacing the code at line 350 (vendor/unisharp/laravel-filemanager/src/views/script.blade.php).

if (path !== ds) {
    item_url = item_url + path + ds;
} else {
    item_url = item_url + ds;
}

Upvotes: 0

Rifqi alfurqan
Rifqi alfurqan

Reputation: 1

Remove this code (you can find it at line 350 )

if (path.indexOf(ds) === 0) {
path = path.substring(1);
}

from this file script.blade.php file path = vendor/unisharp/laravel-filemanager/src/views/script.blade.php

source https://github.com/UniSharp/laravel-filemanager/issues/102

Upvotes: 0

Placid
Placid

Reputation: 1448

Its a bug in Unisharp File Manager and it has been reported here:

https://github.com/UniSharp/laravel-filemanager/issues/102

The issue reporter has also found a solution which I am quoting below:

It worked after I removed the following from vendor/unisharp/laravel-filemanager/src/views/script.blade.php

if (path.indexOf(ds) === 0) { path = path.substring(1); }

This also solved my issue.

Upvotes: 2

Related Questions