ich möchte für mein Forum einen Upload Mod fürs ACP in dem die Admins Dateien hochladen können ohne FTP-Zugang zu haben. Also eigentlich ein ganz einfacher Upload Mod habe aber Probleme, da ich micht nicht so mit Php auskenne und mehr oder weniger Codeschnipsel zusammenkopiert habe.
admin/admin_upload.php
Code: Alles auswählen
<?php
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['General']['Upload'] = $filename;
return;
}
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
$template->set_filenames(array(
"body" => "admin/upload.tpl")
);
$template->assign_vars(array(
"L_UPLOAD_TITLE" => $lang['upload_title'],
"L_UPLOAD_DESC" => $lang['upload_desc'],
"L_UPLOAD_HEAD" => $lang['upload_head'],
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>
Code: Alles auswählen
<?php
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['General']['Upload'] = $filename;
return;
}
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
$dateityp = GetImageSize($_FILES['upload']['tmp_name']);
if($dateityp[2] != 0)
{
if($_FILES['upload']['size'] < 102400)
{
move_uploaded_file($_FILES['upload']['tmp_name'], "upload/".$_FILES['upload']['name']);
echo "{L_UPLOAD_SUCCESS}";
}
else
{
echo "{L_UPLOAD_ERROR_SIZE}";
}
}
else
{
echo "{L_UPLOAD_ERROR_TYPE}";
}
$template->set_filenames(array(
"body" => "admin/upload.tpl")
);
$template->assign_vars(array(
"L_UPLOAD_SUCCESS" => $lang['upload_success'],
"L_UPLOAD_ERROR_SIZE" => $lang['upload_error_size'],
"L_UPLOAD_ERROR_TYPE" => $lang['upload_error_type'],
);
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
?>
Code: Alles auswählen
<h1>{L_UPLOAD_TITLE}</h1>
<p>{L_UPLOAD_DESC}</p>
<form method="post" enctype="multipart/form-data" action="admin_upload_send.php"><table cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
<tr>
<th class="thHead">{L_UPLOAD_HEAD}</th>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="5" border="0" align="center">
<tr>
<td class="row1" align="center"><input name="upload" type="file" size="47"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="catBottom" colspan="5" align="center"><input type="submit" value="Upload"></td>
</tr>
</table></form>
Gruß
Dav1d