tinyfilemanager
tinyfilemanager copied to clipboard
Pass a url parameter to tinyfilemanager for adding subfolder to root_path
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
Try change:
$root_path = 'rfq_documents'/.$newpath;
To:
$root_path = 'rfq_documents/'. $newpath;
(/ is part of the path-string)
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; ?>
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.
try this, add condition checks if needed
// always use ?p=
if (!isset($_GET['p']) && empty($_FILES)) {
fm_redirect(FM_SELF_URL . '?p=&subdir='.$_GET['subdir']);
}
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=
add $_GET['subdir']
params to following lines
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
I am still trying to get this to work. Do you have any more suggestions?
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; }
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.