[Typo3-dev] If in backend-mode then read image from this folder...
Jacob Lindhardsen
web at jacoblindhardsen.dk
Mon Jul 5 09:50:31 CEST 2004
Hi All.
I am uplading via the frontend and I am not having any success at all with
being able to edit the file in the backend. Well, if I just put the image in
the root of the site then there are no problems - but if I am asking for a
specific folder it just wont happen.
Following the video from Kasper and using the admin_interface I am only able
to display the image in the frontend and then only by NOT setting the
uploadfolder manually in the imgTSConfig in the tx_myextension_pi1.php-file
like in the video ?
This is not a problem, but then I cant load in the image in the backend,
since it reads it as
/uploads/tx_myextension/uploads/tx_myextension/myimage.gif - and there is no
image ressource as it says when I try to delete a record named
"/uploads/tx_myextension/myimage.gif" in the backend.
It seems the admininterface is attaching the uploadfolder to the file as
well as to the folder it is supposed to be in ?
This is the code that names the uploadfile:
$uploadfile =
$TCA[$this->conf["table"]]["columns"][$value1]["config"]["uploadfolder"]."/"
.$_FILES["tx_admininterface_pi1"]["name"]["DATA"][$value1];
Could someone explain me the first part - not the $_FILES-part - I know that
much.... Maybe u can see why TYPO3 reads the file in wrongly here ?
and this is the code that handles the upload all in all:
case 'group' :
if
($TCA[$this->conf["table"]]["columns"][$value1]["config"]["internal_type"]==
"file") {
if (isset($this->piVars["DATA"][$value1])) {
// do file upload
//$tmpFileName=$this->piVars["DATA"][$value1];
$filename=$_FILES["tx_admininterface_pi1"]["name"]["DATA"][$value1];
if ($filename!="") {
$fl=strlen($filename);
$fext=substr($filename,$fl-3);
//debug($fext);
//debug($this->conf["upload."]["allowed"]);
if
(strlen($fext)>0&&in_array($fext,explode(",",$this->conf["upload."]["allowed
"]))) {
$uploadfile =
$_FILES["tx_admininterface_pi1"]["name"]["DATA"][$value1];
//debug($uploadfile);
if(move_uploaded_file($this->piVars["DATA"][$value1],
$uploadfile)) {//succes!
$incoming[$value1]=$uploadfile;chmod($uploadfile, 0644);
//$errors.="<p>Upload Successful</p>";
//debug("upload successful");
} else {
$incoming[$value1]="";
$errors[$value1]="<div ".$this->pi_classParam("warning")." >Vi
kunne ikke modtage din fil - prøv venligst igen.</div>";
//debug("upload failed");
}
} else {
$errors[$value1]="<div ".$this->pi_classParam("warning")." >Du
kan kun uploade i gif,jpg,jpeg eller png.</div>";
}
}
}
}
break;
Any ideas ??
Thanks in advance - this is the third time I am trying to get help.
Jacob from Denmark.
More information about the TYPO3-dev
mailing list