[GH-ISSUE #325] Problem with $directories_users and preview #239

Closed
opened 2026-03-02 15:57:08 +03:00 by kerem · 5 comments
Owner

Originally created by @MaartenV87 on GitHub (Mar 19, 2020).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/325

Hi there,

On my website i needed the use the following format to be able to let users access their own personal space.
$directories_users = array(
'user' => '/customers/f/4/f/sbshasselt.be/httpd.www/wiuk/demo/uploads/bowi/',
);

However when the user goes to their space they can't preview the items. The URL is broken.
It creates a location like http://sbshasselt.be/wiuk/customers/f/4/f/sbshasselt.be/httpd.www/wiuk/demo/uploads/bowi/Hasselt.png
and it shoulld be
http://sbshasselt.be/wiuk/demo/uploads/bowi/Hasselt.png

On the website it looks like
preview

Any idea on a fix?

The admin with no restrictions on folders does see the preview.

Originally created by @MaartenV87 on GitHub (Mar 19, 2020). Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/325 Hi there, On my website i needed the use the following format to be able to let users access their own personal space. $directories_users = array( 'user' => '/customers/f/4/f/sbshasselt.be/httpd.www/wiuk/demo/uploads/bowi/', ); However when the user goes to their space they can't preview the items. The URL is broken. It creates a location like http://sbshasselt.be/wiuk/customers/f/4/f/sbshasselt.be/httpd.www/wiuk/demo/uploads/bowi/Hasselt.png and it shoulld be http://sbshasselt.be/wiuk/demo/uploads/bowi/Hasselt.png On the website it looks like ![preview](https://user-images.githubusercontent.com/7249912/77052921-d589a000-69cd-11ea-88a9-ff196626281e.png) Any idea on a fix? The admin with no restrictions on folders does see the preview.
kerem 2026-03-02 15:57:08 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@prasathmani commented on GitHub (Mar 19, 2020):

@MaartenV87 , try this

$directories_users = array(
    'user' => $_SERVER['DOCUMENT_ROOT'].'/wiuk/demo/uploads/bowi'
);
<!-- gh-comment-id:601250439 --> @prasathmani commented on GitHub (Mar 19, 2020): @MaartenV87 , try this ```php $directories_users = array( 'user' => $_SERVER['DOCUMENT_ROOT'].'/wiuk/demo/uploads/bowi' ); ```
Author
Owner

@MaartenV87 commented on GitHub (Mar 20, 2020):

Thank you for your answer, but this didn't fixed the problem.
The files are downloadable so their location is correct. It's only the preview that doesn't work.

I think it's something with the FM_ROOT_PATH or $root_path function in combination with my host structure. Maybe if I can hardcode the preview function to not use the FM_ROOT_PATH it will work for me? However I can't find where in the code the preview is build.

<!-- gh-comment-id:601625042 --> @MaartenV87 commented on GitHub (Mar 20, 2020): Thank you for your answer, but this didn't fixed the problem. The files are downloadable so their location is correct. It's only the preview that doesn't work. I think it's something with the FM_ROOT_PATH or $root_path function in combination with my host structure. Maybe if I can hardcode the preview function to not use the FM_ROOT_PATH it will work for me? However I can't find where in the code the preview is build.
Author
Owner

@jin146 commented on GitHub (Mar 26, 2020):

Hi, same issue here after a fresh install, even with the admin account (this one doesn't looks like a real admin though, or I missed something).
A user can preview the files until I set his personal directory.
Edit: found a workaround by deleting user specific directories and setting up proper $root_path and $root_url variables (https://github.com/prasathmani/tinyfilemanager/issues/329).

<!-- gh-comment-id:604434173 --> @jin146 commented on GitHub (Mar 26, 2020): Hi, same issue here after a fresh install, even with the admin account (this one doesn't looks like a real admin though, or I missed something). A user can preview the files until I set his personal directory. **Edit:** found a workaround by deleting user specific directories and setting up proper $root_path and $root_url variables (https://github.com/prasathmani/tinyfilemanager/issues/329).
Author
Owner

@Xeon33 commented on GitHub (Mar 26, 2020):

Hello,
It looks like when a full path directory is set for a user, the full path and the root path folder is added in the link preview (depends of your web server config).

If you don't want to have the user folder inside tinyfilemanager,
you can try to add a symbolic link (bob) in tinyfilemanager-master folder to your user bob folder and
not use a full path like this:
$directories_users = array(
'bob' => 'bob'

and maybe do this too:

If you remove "$wd.DIRECTORY_SEPARATOR." from this line:

$root_url = $root_url.$wd.DIRECTORY_SEPARATOR.$directories_users[$_SESSION[FM_SESSION_ID]['logged']];

to looks like this:
$root_url = $root_url.$directories_users[$_SESSION[FM_SESSION_ID]['logged']];

the tinymanager path it's not added anymore, and the link for preview is fine.

That worked for me.

I don't know if doing this could produces some side effects.
Please wait confirmation from Prasathmani

<!-- gh-comment-id:604542691 --> @Xeon33 commented on GitHub (Mar 26, 2020): Hello, It looks like when a full path directory is set for a user, the full path and the root path folder is added in the link preview (depends of your web server config). If you don't want to have the user folder inside tinyfilemanager, you can try to add a symbolic link (bob) in tinyfilemanager-master folder to your user bob folder and not use a full path like this: $directories_users = array( 'bob' => 'bob' and maybe do this too: If you remove "$wd.DIRECTORY_SEPARATOR." from this line: $root_url = $root_url.**$wd.DIRECTORY_SEPARATOR.**$directories_users[$_SESSION[FM_SESSION_ID]['logged']]; to looks like this: $root_url = $root_url.$directories_users[$_SESSION[FM_SESSION_ID]['logged']]; the tinymanager path it's not added anymore, and the link for preview is fine. That worked for me. I don't know if doing this could produces some side effects. Please wait confirmation from Prasathmani
Author
Owner

@alaasharkawy60 commented on GitHub (Oct 17, 2022):

hello , I've the same problem
it's working for download not for preview

https://github.com/prasathmani/tinyfilemanager/issues/325#issue-584281851

<!-- gh-comment-id:1280749119 --> @alaasharkawy60 commented on GitHub (Oct 17, 2022): hello , I've the same problem it's working for download not for preview https://github.com/prasathmani/tinyfilemanager/issues/325#issue-584281851
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tinyfilemanager#239
No description provided.