mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2026-04-26 10:55:56 +03:00
[GH-ISSUE #633] Pass a url parameter to tinyfilemanager for adding subfolder to root_path #451
Labels
No labels
Feature
Feature
Is It Really an Issue?
Need More Info
Request
Security
bug
duplicate
enhancement
enhancement
help wanted
invalid
pull-request
question
suggestion
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tinyfilemanager#451
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gthurmon on GitHub (Sep 24, 2021).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/633
I want to be able to pass a dynamic variable in the URL string
like https:\xxxx.com\tinyfilemanager.php?subdir=2070
where '2070' is a subfolder of \rfq_documents\ i.e. \rfq_documents\2070 is a real folder.
BTW there are over 6,000 subfolders under \rfq_document\
This does not work:
// Get url [subdir] parameter passed to this script
$newpath = $_GET['subdir'];
$thissubdir = '/rfq_documents/'.$newpath;
// Root path for file manager
// use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
$root_path = $thissubdir; //this just opens '/rfq_documents' as if $newpath is empty.
$root_path = 'rfq_documents/2070'; // hard coding works just fine, but I need a dynamic variable here to replace '2070'.
$root_path = 'rfq_documents'/.$newpath; // does not work treats $newpath as empty.
$root_path = 'rfq_documents'/.$_GET['subdir']; // does not work treats as empty.
$root_path = $thissubdir; // does not work treats as '/rfq_documents/'.
Can some please help. I have almost no experience with PHP. What am I doing wrong here.
Thanks
@EV-soft commented on GitHub (Sep 24, 2021):
Try change:
$root_path = 'rfq_documents'/.$newpath;To:
$root_path = 'rfq_documents/'. $newpath;(/ is part of the path-string)
@gthurmon commented on GitHub (Sep 24, 2021):
Sorry that was just a typo there in the question.
This still does not work for me. It is as if the $_GET is not getting so $newpath is an empty string.
$newpath = $_GET['subdir'];
$thissubdir = '/rfq_documents/'.$newpath;
$root_path = '/rfq_documents/'. $newpath;
and the URL string is getting rewritten as ...php?p=
This script woorks on the same server. Just not in tinyfilemanager.php
<?php // Get url [subdir] parameter passed to this script $newpath = $_GET['subdir']; $root_path = '/rfq_documents/'. $newpath; echo $root_path; ?>@gthurmon commented on GitHub (Sep 24, 2021):
BTW:
rfq_document is a virtual directory on the site's root.
PHP version is 7.4.13
Windows 20019 Server using IIS
I am missing something very simple here or this is way over my head.
@prasathmani commented on GitHub (Sep 24, 2021):
try this, add condition checks if needed
@gthurmon commented on GitHub (Sep 24, 2021):
That works great for the initial display, but if I click on a file or folder it brings up all the files under the root of /rfq_docments/.
And the URL goes back to ........com/tinyfilemanager.php?p=
@prasathmani commented on GitHub (Sep 25, 2021):
add


$_GET['subdir']params to following lines@gthurmon commented on GitHub (Sep 25, 2021):
Prasath,
First I would like to thank you for helping me with this. The latest Microsoft patch has broke IE and I was using <iframe name="I5" src="file://cfserver/rfq_documents$/#rfq.id#" to bring up windows explorer to manage file for each RFQ.
It is on our intranet and work well enough that I did not have to write more code to manage files.
I added to these lines as suggest and it now works for hyperlinked on files, but not on folders or any link that takes you back.
Given the seer number of '?p=' there are in the script is there a way to just replace the $root_path = $_GET['subdir'];
i.e. .....com/tinyfilemanager.php?subdir=/rfq_documents/2071 and the 'p=' would be as is now any subfolder under /rfq_documents/2071/ that was selected.
Again I really can't tell you how much I appreciate your time, patience and support with this. If I could get this to work it would save me months of work redoing all those apps that use the IE in an iframe.
Greg
@gthurmon commented on GitHub (Sep 30, 2021):
I am still trying to get this to work. Do you have any more suggestions?
@vagelisdrivas commented on GitHub (Feb 20, 2022):
I have found the solution i think.
On line 1 put
$whatever_you_like = $_GET['p'];
On line 63:
/ Root path for file manager
// use absolute path of directory i.e: '/var/www/folder' or $_SERVER['DOCUMENT_ROOT'].'/folder'
$root_path = $_SERVER['DOCUMENT_ROOT'].'/uploads/plates/';
i used the path of all my folders
Then on line 384
// clean and check $root_path
$vagelis=$root_path.$whatever_you_like;
$vagelis = rtrim($vagelis, '\/');
$vagelis = str_replace('\', '/', $vagelis);
if (!@is_dir($vagelis))
{
echo "
".lng('Root path').""{$vagelis}" ".lng('not found!')."
";exit;
}
@mut9bu commented on GitHub (Jul 5, 2022):
Hi @gthurmon
I am working also since weeks for this topic. Similar to you I try to pass the remote network path in the URL in a parameter. (Because each connected user wants to connect to the selected IP's network path)
Did you find a solution? I also tried the suggestions, and it works just at the initial page. If you want to go into the subdirectories I get an error "Path not found" I would be very happy if you can share your last status. I will also share with you if I have something new.