Hallo Manfredo,
ich habe eine Lösung gefunden.
Ich habe ein wenig im Code der Extension rumgefummelt.
Du musst einfach den Code mit diesem ersetzen:
/***************************************************************
* Copyright notice
*
* (c) 2003 Mads Brunn (brunn@mail.dk)
* All rights reserved
*
* This script is part of the Typo3 project. The Typo3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Plugin 'Upload' for the 'fileupload' extension.
*
* @author Mads Brunn <brunn@mail.dk>
*/
require_once(PATH_tslib."class.tslib_pibase.php");
class tx_fileupload_pi1 extends tslib_pibase {
var $prefixId = "tx_fileupload_pi1"; // Same as class name
var $scriptRelPath = "pi1/class.tx_fileupload_pi1.php"; // Path to this script relative to the extension dir.
var $extKey = "fileupload"; // The extension key.
var $maxsize;
var $uploadid = 'userfile';
/**
* [Put your description here]
*/
function main($content,$conf) {
$GLOBALS["TSFE"]->set_no_cache();
$this->conf=$conf;
file://debug($this->conf);
$this->maxsize=$this->conf['maxsize']?$this->conf['maxsize']:100000;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$content='';
if($_POST['action']=='Upload'){
$content.=$this->handleUpload();
}
$content.=$this->displayUploadForm();
return $this->pi_wrapInBaseClass($content);
}
function displayUploadForm(){
$content=' <form enctype="multipart/form-data" action=
"'.$this->pi_getPageLink($GLOBALS["TSFE"]->getStorageSiterootPids()).'" method="POST" target="'.$this->conf['target'].'">
<input type="hidden" name="MAX_FILE_SIZE" value="'.$this->maxsize.'">
<input name="'.$this->uploadid.'" type="file">
<input type="hidden" name="no_cache" value="1">
<input type="submit" name="action" value="'.$this->pi_getLL('submitupload').'">
</form>';
return $content;
}
function handleUpload(){
global $TYPO3_CONF_VARS;
$content='';
$uploaddir = is_dir($this->conf['path'])?$this->conf['path']:$TYPO3_CONF_VARS['BE']['fileadminDir'];
$uploadfile = $uploaddir.$_FILES[$this->uploadid]['name'];
if(is_file($uploadfile) && $this->conf['noOverwrite']){//file already exists?
return '
'.$this->pi_getLL('error.exist').'
';
}
if($this->fileTooBig($_FILES[$this->uploadid]['size'])){
$content.='
'.$this->pi_getLL('error.toobig').'
';
}
if(!$this->mimeAllowed($_FILES['userfile']['type'])){ file://mimetype allowed?
return '
'.$this->pi_getLL('error.mimenotallowed').$_FILES['userfile']['type'].'
';
}
if(!$this->extAllowed($_FILES[$this->uploadid]['name'])){ file://extension allowed?
return '
'.$this->pi_getLL('error.extensionnotallowed').'
';
}
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {//succes!
return '
'.$this->pi_getLL('uploadsuccesfull').'
';
} else {
return $this->handleError($_FILES[$this->uploadid]['error']);
}
return "jo kommt an";
// $content;
}
function handleError($error){
$content='';
switch ($error){
case 0:
break;
case 1:
case 2:
$content.='
'.$this->pi_getLL('error.toobig').'
';
break;
case 3:
$content.='
'.$this->pi_getLL('error.partial').'
';
break;
case 4:
$content.='
'.$this->pi_getLL('error.nofile').'
';
break;
default:
$content.='
'.$this->pi_getLL('error.unknown').'
';
}
return $content;
}
function mimeAllowed($mime){
if(!($this->conf['checkMime'])) return TRUE; file://all mimetypes allowed
$includelist = explode(",",$this->conf['mimeInclude']);
$excludelist = explode(",",$this->conf['mimeExclude']); file://overrides includelist
file://debug($excludelist);
file://debug($includelist);
return ( (in_array($mime,$includelist) || in_array('*',$includelist)) && (!in_array($mime,$excludelist)) );
}
function extAllowed($filename){
if(!($this->conf['checkExt'])) return TRUE; file://all extensions allowed
$includelist = explode(",",$this->conf['extInclude']);
$excludelist = explode(",",$this->conf['extExclude']) ; file://overrides includelist
file://debug($excludelist);
file://debug($includelist);
$extension='';
if($extension=strstr($filename,'.')){
$extension=substr($extension, 1);
return ((in_array($extension,$includelist) || in_array('*',$includelist)) && (!in_array($extension,$excludelist)));
} else {
return FALSE;
}
}
function fileTooBig($filesize){
return $filesize > $this->maxsize;
}
}
if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/fileupload/pi1/class.tx_fileupload_pi1.php"]) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/fileupload/pi1/class.tx_fileupload_pi1.php"]);
}
?>