Seite 1 von 1

Upload Script für ACP

Verfasst: 30.06.2007 16:32
von SKYSURFER2002
Hallo,

ich schreibe gerade ein Script für das ACP mit dem ich Bilder in ein Verzeichnis laden kann. Doch leider klappt das nicht. Hier mal die PHP-Datei:

Code: Alles auswählen

...
if(isset($_GET['action']) && $_GET['action'] == "neu_insert")
{


	$template->set_filenames(array(
	"body" => "admin/flyer_insert.tpl")
	);
	
	$ordner = "gd";
	$name = $_FILES['datei']['name'];
	$neuer_pfad = $phpbb_root_path . $ordner . $name;
	
	$dateityp = GetImageSize($_FILES['datei']['tmp_name']);
	if($dateityp[2] != 0)
	{	
		if($_FILES['datei']['size'] <  102400)
		{
			move_uploaded_file($_FILES['datei']['tmp_name'], $neuer_pfad);
			$status = "erl";
		}
		else
		{
			$status = "size";
		}
	}
	else
	{
		$status = "typ";
	}

		
	$template->assign_vars(array(
	'fehler' => $status,
	));


}
...
und das Template:

Code: Alles auswählen

<h1>{L_FLYER_ALL}</h1>
<p>{L_FLYER_ALL_TOO}</p>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td height="10"></td>
</tr>
</table>
<form action="{S_POST_ACTION}" method="POST" name="post">
<table border="0" cellpadding="3" cellspacing="1" class="forumline" align="center">
<tr>
<th class="thTop" width="300">{L_FLYER_NEU_NEU}</th>
</tr>
<tr>
<td class="row1" align="center">
	<table width="100%" align="left" border="1" cellpadding="3" cellspacing="1">
	<tr>
	<td class="row1" width="50">{L_STARTTAG}</td>
	<td class="row1" width="50"><input type="text" name="START_TAG" value="{START_TAG}" size="3" maxlength="2" class="post" tabindex="1" title="START_TAG"></td>
	<td class="row1" width="50"><td>
	<td class="row1" width="50">{L_ENDTAG}</td>
	<td class="row1" width="50"><input type="text" name="END_TAG" value="{END_TAG}" size="3" maxlength="2" class="post" tabindex="7" title="END_TAG"></td>
	</tr>
	<tr>
	<td class="row1" width="50">{L_STARTMONAT}</td>
	<td class="row1" width="50"><input type="text" name="START_MONAT" value="{START_MONAT}" size="3" maxlength="2" class="post" tabindex="2" title="START_MONAT"></td>
	<td class="row1" width="50"><td>
	<td class="row1" width="50">{L_ENDMONAT}</td>
	<td class="row1" width="50"><input type="text" name="END_MONAT" value="{END_MONAT}" size="3" maxlength="2" class="post" tabindex="7" title="END_MONAT"></td>
	</tr>
	<tr>
	<td class="row1" width="50">{L_STARTJAHR}</td>
	<td class="row1" width="50"><input type="text" name="START_JAHR" value="{START_JAHR}" size="6" maxlength="4" class="post" tabindex="3" title="START_JAHR"></td>
	<td class="row1" width="50"><td>
	<td class="row1" width="50">{L_ENDAHR}</td>
	<td class="row1" width="50"><input type="text" name="END_JAHR" value="{END_JAHR}" size="6" maxlength="4" class="post" tabindex="9" title="END_JAHR"></td>
	</tr>
	<tr>
	<td class="row1" width="50">{L_STARTSTD}</td>
	<td class="row1" width="50"><input type="text" name="START_STD" value="{START_STD}" size="3" maxlength="2" class="post" tabindex="4" title="START_STD"></td>
	<td class="row1" width="50"><td>
	<td class="row1" width="50">{L_ENDSTD}</td>
	<td class="row1" width="50"><input type="text" name="END_STD" value="{END_STD}" size="3" maxlength="2" class="post" tabindex="10" title="END_STD"></td>
	</tr>
	<tr>
	<td class="row1" width="50">{L_STARTMIN}</td>
	<td class="row1" width="50"><input type="text" name="START_MIN" value="{START_MIN}" size="3" maxlength="2" class="post" tabindex="5" title="START_MIN"></td>
	<td class="row1" width="50"><td>
	<td class="row1" width="50">{L_ENDMIN}</td>
	<td class="row1" width="50"><input type="text" name="END_MIN" value="{END_MIN}" size="3" maxlength="2" class="post" tabindex="11" title="END_MIN"></td>
	</tr>
	<tr>
	<td class="row1" width="50">{L_STARTSEC}</td>
	<td class="row1" width="50"><input type="text" name="START_SEC" value="{START_SEC}" size="3" maxlength="2" class="post" tabindex="6" title="START_SEC"></td>
	<td class="row1" width="50"><td>
	<td class="row1" width="50">{L_ENDSEC}</td>
	<td class="row1" width="50"><input type="text" name="END_SEC" value="{END_SEC}" size="3" maxlength="2" class="post" tabindex="12" title="END_SEC"></td>
	</tr>
	<tr>
	<td class="row1" width="250" colspan="6">
		<input name="datei" type="file" size="30"><br><br>
		<input type="submit" accesskey="s" tabindex="6" name="post" class="sendtext" value="{L_SUBMIT}" />
	</td>
	</tr>
	<tr>
	<td class="row1" width="250" colspan="6">{picture}</td>
	</tr>
	</table>
</td>
</tr>
</table>
</form>
Muss ich da noch irgendwelche Parameter übergeben? Denn wenn ich das Script als eines verwende, welches nicht in das PHPbb eingebaut ist, dann klappt es. Nur im PHPbb nicht.


Christian

Verfasst: 30.06.2007 17:38
von Pyramide
Definiere "klappt nicht"...

BTW: [kb=knigge#code]Posten von Code[/kb]

Verfasst: 01.07.2007 00:16
von SKYSURFER2002
Hallo,

mit "klappt nicht" meine ich, dass die Datei nicht in das Verzeichnis der Variable: $neuer_pfad kopiert wird. Desweiteren wird immer als Variable: $status der Wert "typ" ausgegeben. D.h. die Datei welche ich zum upload ausgewählt hatte, nicht den Kriterien von

Code: Alles auswählen

if($dateityp[2] != 0) 
entspricht. Verwende ich nun das Script nicht im ACP des PHPbb, dann wird die Datei in das richtige Verzeichnis kopiert/verschoben.


Christian