Für eine eigene componente benötige ich einen Dateiupload aus dem backend.
das ganze sieht nun wie folgt aus
html
HTML-Code:
<form action="index2.php" method="post" name="adminForm" enctype="multipart/form-data" >
<input name="instructor_picture" class="input-box-short" id="instructor_picture" type="file">
<input name="button" type="button" class="button" style="margin-left:50px" onclick="javascript:location='index2.php?option=xxxxx&task=upload';" value="Upload" />
</form>
php
PHP-Code:
function upload_picture_instructors(){
global $database;
// Variabeln festlegen
$allowed_types = array('jpg', 'jpeg');
$dest = $GLOBALS['mosConfig_absolute_path'].'/images/';
$picture = mosGetParam($_FILES, 'instructor_picture', null) ;
$picture_name = $picture['name'];
$picture_tmp_name = $picture['tmp_name'];
// Datei hochgeladen?
if( is_uploaded_file( $picture_tmp_name ) ) {
xxxxxxx
}
else
echo 'Error';
}
in die Funktion komme ich zwar rein, aber ich lande immer im error zweig.
laut API müsste das so Funktionieren, tuts aber irgendwie nicht. Sieht jmd eventuel meinen Fehler oder hat einer bessere Variante?
Für jede Antwort bin ich Dankbar.
Gruß dikron
Lesezeichen