barryvdh / laravel-elfinder

elFinder bundle for Laravel
739 stars 171 forks source link

URL in standalonepopup #223

Open kovalenko-anton opened 6 years ago

kovalenko-anton commented 6 years ago

Greetings, thanks for your work. I use elfinder with ckeditor and it work fine. Now I need stand alone popup and it wotk fine to )). but this method returns path of file, but i need URL with disk in filesystem like it work in ckeditor. How can I get Url ?

function processSelectedFile(filePath, requestingField) { $('#' + requestingField).val(filePath).trigger('change'); }

I see only filepath, how can I get URL?

and second question is,- I recieve path = upload/1.png , but is path relative public directory, not disc I use in storage area

hilmanfaiz commented 6 years ago

you can get base url by calling laravel helper {{url('/')}} in your blade.php

brankopetric commented 4 years ago

I had same problem with popup but I manage to find solution if it is relative now :) But if somebody is looking. Here is my solution:

There is a vendor view standalonepopup.blade.php (and standalonepopup.php) with a next code:

getFileCallback: function (file) { //window.parent.processSelectedFile(file.path, '{{ $input_id }}'); // just replace file.path with file.url window.parent.processSelectedFile(file.url, '{{ $input_id }}'); parent.jQuery.colorbox.close(); } This will return URL instead of relative path