Hallo,
ich möchte gerne eine Extension schreiben, in der man Dateien auf den Server läd. Ich habe auch bereits folgenden Code geschrieben.
HTML-Code:
<form name="tx_commercelisting_content_left_form"
id="tx_commercelisting_content_left_form"
action="/produkt.html?&article=3"
enctype="multipart/form-data" method="post"> <table cellpadding="0" cellspacing="0"> <tr class="tx_commercelisting_upload_pic"> <td id="picture_upload_img"></td> </tr> <tr class="tx_commercelisting_upload_pic"> <td> <input type="file" name="file" onchange="" /> <input type="hidden" name="MAX_FILE_SIZE" value="500000" /> <div> <input type="checkbox" id="tx_commercelisting_upload_checkbox" /> <label for="tx_commercelisting_upload_checkbox" onclick="">Ich versichere, dass ich dieses Foto hochladen darf...</label> </div> <input type="submit" name="submit" value="hochladen" /> </td> </tr> </table> </form> PHP-Code:
function uploadPic($template, $myXajaxRequest=''){
$markerArray['###UPLOAD_SUBMIT###'] = $this->pi_getLL("upload_submit");
$markerArray['###UPLOAD_CHECKBOX_TEXT###'] = $this->pi_getLL("upload_chekcbox_text");
// Fileupload
$uploaddir = '/var/www/uploads/';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir.$_FILES['userfile']['name'])) {
print "File is valid, and was successfully uploaded. Here's some more debugging info:<br />";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:<br />";
print_r($_FILES);
}
return $this->cObj->substituteMarkerArrayCached($template['picture_upload'], $markerArray);
}
Leider funktioniert es überhaupt nicht, und ich weiß nicht wieso. Kann jemand von euch mir helfen oder tips geben?
Habe bereits auch schon die Extension fileupload gefunden, weiß aber nicht, wie ich diese in meine Extension interieren kann. Weiß jemand ansonsten, wie ich das hin bekomme?