1. Uploading files to template folder from Admincp

Uploading files to template folder from Admincp

  |   6
Uploading files to template folder from Admincp


This is a useful hack for uploading files to template folder from Admin cp, in case of you don't want to use FTP client software or you can't use FTP client software to upload files, in this case you can use this hack to upload files to your template easily

Installation:

Open file: engine/in/templates.php

Find:
	  <div class="col-md-2">
<div id="filetree" class="filetree"></div>
<br /><input onclick="createfile()" type="button" class="btn btn-blue" value="{$lang['template_create']}">
</div>

Add BEFORE:
HTML;
// Upload files to the folder with the template
echo "<table width=\"350px\" style=\"table-layout:fixed;margin:10px auto\"><tr><td style=\"padding-left:10px;text-align:center\"><div class=\"navigation\"><b>Upload files to the template folder</b></div><form method=\"post\" enctype=\"multipart/form-data\">Select the folder to upload to: <select name=\"dirname\" class=\"uniform\">";
$tplpath = "/templates/".$do_template;
showTree("./".$tplpath, "");
function showTree($folder, $space) {
$files = scandir($folder);
foreach($files as $file) {
if (($file == '.') || ($file == '..')) continue;
$f0 = $folder.'/'.$file;
if (is_dir($f0)) { echo "<option value=\"\" />".$space.$file."</value>\n"; }
}
}
echo "</select><div style=\"height:10px\"></div><input name=\"file\" size=\"18\" type=\"file\" value=\"\" /><div style=\"height:10px\"></div><input name=\"submit\" type=\"submit\" value=\"Upload\" class=\"btn btn-primary\" /></form>";
$dirname = htmlspecialchars(stripslashes($_POST['dirname']));
$file = $_FILES['file']['tmp_name'];
$filename = $_FILES['file']['name'];
if(!empty($file)) {
ini_set('memory_limit', '32M');
$maxsize = "20000000";
$extentions = array("gif","jpg","jpeg","png","swf","js","css","tpl");
$size = filesize ($_FILES['file']['tmp_name']);
$type = strtolower(substr($filename, 1 + strrpos($filename, ".")));
if($size > $maxsize) {
echo 'You upload too large file';
} elseif(!in_array($type,$extentions)) {
echo '<b>This file is forbidden to be downloaded.</b>';
} else {
if (copy($file, ROOT_DIR.$tplpath."/".$dirname."/".$filename))
echo "The file <b>".$filename."</b> is uploaded into the folder ".$tplpath."/".$dirname."/setTimeout('location.replace(\"{$PHP_SELF}?mod=templates\")', 3000);";
}
}
echo "</td></tr></table>";
// end load
echo <<<HTML
<div class="unterline"></div>

Screenshot:

Uploading files to template folder from Admincp
Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.

Details

+1

Comments 6

sri
sri
Members
Commented By sri on September 8, 2014 (3:47 am)
hi

i got error.. add this hack..pl help me...

Parse error: syntax error, unexpected '100' (T_LNUMBER), expecting ',' or ';' in /var/www/vhosts/domainname/engine/inc/templates.php on line 295


Information!You must register before you can view this text. Please register or Login
N/A 19Forum topics : 12Forum replies : 36Forum likes : 1
DLEStarter
DLEStarter
DLE TEAM
Commented By DLEStarter on September 8, 2014 (4:07 am)
sri,

It very difficult when the user submit article with "code" but use "quote" instead because if user doesn't know how to submit article then it's hard for us to guess what it is...

Anyway I have reviewed and modified the instruction to new steps and new code. but honestly I don't even know if it really upload the images or files, I don't think it will work correctly because the instruction is using "form" within "form" this is against the mother nature of script...

Thank you for report. please report back if it really work, otherwise the tutorial will be removed.
29 225Forum topics : 9Forum replies : 558Forum likes : 116
ilan
ilan
Members
Commented By ilan on April 25, 2015 (3:51 am)
this hack not support in 10.4
plz help.
N/A 2Forum topics : 0Forum replies : 0Forum likes : 0
ilan
ilan
Members
Commented By ilan on April 29, 2015 (1:44 am)
Nobody came to help
N/A 2Forum topics : 0Forum replies : 0Forum likes : 0
DLEStarter
DLEStarter
DLE TEAM
Commented By DLEStarter on April 29, 2015 (12:07 pm)
Quote: ilan
Nobody came to help

No, actually no body cares about because this hack is absolutely no need if you are admin or owner, all you need is upload all files to your server folder "/uploads/"
Quote: DLEStarter
Anyway I have reviewed and modified the instruction to new steps and new code. but honestly I don't even know if it really upload the images or files, I don't think it will work correctly because the instruction is using "form" within "form" this is against the mother nature of script...

Find good developer is better than wait for someone to edit something which may never worked at all. this site never said anything as "Expert" or "can fix everything"
We are not professional in Datalife Engine and we are not pretending to be, we are only newbie. But we will try our best to help users who need helps as much as we can

This means not everything that we can fix...
29 225Forum topics : 9Forum replies : 558Forum likes : 116
beqabeqa33
beqabeqa33
Members
Commented By beqabeqa33 on November 23, 2015 (4:42 am)
worked for me. thnx laughing
N/A 1Forum topics : 0Forum replies : 0Forum likes : 0
Information!Would you like to leave your comment? Please Login to your account to leave comments. Don't have an account? You can create a free account now.
DLEStarter Notice!Please note...Every hack and every module will get additional queries from your database and some hacks and some modules may result your server overload, so install only what you "need", remove any hacks and modules from your script when you don't need them, all hacks and modules appears in this website are not guaranteed by DLEStarter Team for your script security and compatibility, please read instruction carefully and use hacks and modules at your own risk...Thank you.