[Typo3-dev] folder-problem with backend/fileupload/uploadfolder

Jacob Lindhardsen web at jacoblindhardsen.dk
Wed Jun 16 14:08:39 CEST 2004


Hi list

Maybe someone can find some error in this piece of code that handles a fileupload. It is the Frontend Admin Interface that I am using together with my own extension.

I can make it upload alright, but then in the backend it reads the image in wrong by including the path in the filename like: uploads%2Ftx_annoncer%2Fsection_image.gif

and in the text-field:

/uploads/tx_annoncer/sectionimage.gif.

If I change the uploadfolder in tca.php - it obeys in the move_uploadedfile-function.

This is the code that handles the upload and causes the error

-------------------------------------------------------------------------------------

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 = $TCA[$this->conf["table"]]["columns"][$value1]["config"]["uploadfolder"]."/".$_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;			
						default:
							
					}
				//}		
			}	
			
			//debug("parsed as");		
			//debug($incoming);
			
			return $errors;
		}

-----------------------------------------------------------------------------------------
This produces this error:

Warning: move_uploaded_file(/uploads/tx_annoncer/section_image.gif): failed to open stream: No such file or directory in /var/www/html/typo3conf/ext/admin_interface/pi1/class.tx_admininterface_pi1.php on line 1109

Warning: move_uploaded_file(): Unable to move '/tmp/phpp1Vxce' to '/uploads/tx_annoncer/section_image.gif' in /var/www/html/typo3conf/ext/admin_interface/pi1/class.tx_admininterface_pi1.php on line 1109

the line 1109 is the move_uploadedfile-function from above.


Thanks for anything.

- Jacob Lindhardsen (lindhardsen)

-----------------------
The mailing list archive is found here:
http://typo3.org/documentation/mailing-lists/dev-list-archive/
				





More information about the TYPO3-dev mailing list